|
From: | Dmitry Gutov |
Subject: | Re: web-mode.el |
Date: | Wed, 20 Jun 2012 06:01:00 +0400 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 |
On 19.06.2012 7:09, Stefan Monnier wrote:
It occurs to me that, once the supported interface is established, introducing new syntax-table value becomes not strictly necessary because, for example, a version of Lennart's `with-chunks' macro can be implemented in Lisp by applying whitespace or comment-starter/ender syntax to foreign chunks around the body calls (idea from mmm-noweb). Is that right?That's right as long as you're willing to dynamically modify the buffer (with syntax-table text-properties) every time you move from one chunk to another.
Or just every time I want to indent a line, instead. And if I always use `narrow-to-region' before performing indentation within a submode, the syntax-table text property (unless it's 'whitespace') isn't going to affect the result, so I might as well assign text properties only once when the buffer is parsed for chunks, "commenting out" the submodes.
If you have many chunks, that can be a problem. This can happen if you push the idea of multi-major-mode a bit further and consider for example that comments and strings are really "text-mode chunks" embedded in "some other mode chunks".
Yes, but what follows is defining the supported interface and patching existing packages becomes first priority, and implementing low-level support in C code - only second, which means more time to get the latter right.
For example, I'd like to see a use case for handling submode regions of the same mode as though they're contiguous (as oppsed to isolated), in the context of `syntax-ppss'. If there isn't, it might simplify the implementation.
On 19.06.2012 14:39, Lennart Borgman wrote: > My idea with (with-chunks chunk-table ...) that chunk-table contains > this information instead. Then it can be cashed by the multi major > mode framework.You might want to consider how syntax-ppss cache works. Since text-property change in considered buffer modification, `syntax-ppss-flush-cache' will be called from `before-change-functions', invalidating the cache entries with positions after the edit position, and keeping the ones before it. With your proposal, it would need to somehow keep track of the chunk-table, too.
[Prev in Thread] | Current Thread | [Next in Thread] |