[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Last steps for pretesting (font-lock-extend-region-function)
From: |
Stefan Monnier |
Subject: |
Re: Last steps for pretesting (font-lock-extend-region-function) |
Date: |
Thu, 20 Apr 2006 16:58:44 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
>> So your code needs extend-region both in a-c-f and in f-l-d-f-r ?
> Yes. The region needs extending in two distinct circumstances:
> (i) In after-change, to determine the entire region which needs
> refontifying;
> (ii) In jit-lock-fontify-now, to ensure that each chunk starts and stops
> at a "safe place".
> These are logically disjoint. But it seems that the major mode code to
> do each of them is so similar, that we might as well just have a single
> function, font-lock-extend-region-function, called in two different ways.
IIRC part (i) needs more than an after-change-function: it also needs
a before-change-function. And (again IIRC) it's the part that can already
be solved by placing (from one of the font-lock-keywords rules)
a font-lock-multiline property. Basically it's the part that makes sure
that if a multiline element loses its multiline status, the whole
(previously atomic) text gets properly refreshed.
I find it very hard to believe that b-f-c + a-f-c ends up being as
efficient/elegant/robust as placing a font-lock-multiline property. In all
likely hood, adding the font-lock-multiline property is a matter of adding
a single line of code at the right place (the place where you fontify
the corresponding multiline entity).
Here is the problems I see with your proposal:
- an `extend-region' hook in font-lock-fontify-region is needed
- the font-lock-multiline property should be enough in all cases to make
it unnecessary to use an after-change-function hook.
- adding an after-change-function hook additionally to
a font-lock-fontify-region hook means making font-lock that much more
complex to use and maintain, especially since that after-change-function
basically can't be used without also adding a before-change-function.
- an after-change-function is expensive, and even more when it comes bundled
with a before-change-function, and even more so when compared to
code that's only run during font-locking.
Stefan
- Re: Last steps for pretesting, (continued)
- Re: Last steps for pretesting, Stefan Monnier, 2006/04/20
- Re: Last steps for pretesting, David Kastrup, 2006/04/20
- Re: Last steps for pretesting, Stefan Monnier, 2006/04/20
- Re: Last steps for pretesting, David Kastrup, 2006/04/20
- Re: Last steps for pretesting, Alan Mackenzie, 2006/04/20
- Re: Last steps for pretesting (true file names in load-history?), Alan Mackenzie, 2006/04/19
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/19
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/20
- Re: Last steps for pretesting (font-lock-extend-region-function), Stefan Monnier, 2006/04/20
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/20
- Re: Last steps for pretesting (font-lock-extend-region-function),
Stefan Monnier <=
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/20
- Re: Last steps for pretesting (font-lock-extend-region-function), Stefan Monnier, 2006/04/20
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/21
- Re: Last steps for pretesting (font-lock-extend-region-function), Stefan Monnier, 2006/04/21
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/21
- Re: Last steps for pretesting (font-lock-extend-region-function), Stefan Monnier, 2006/04/21
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/24
- Re: Last steps for pretesting (font-lock-extend-region-function), Stefan Monnier, 2006/04/24
- Re: Last steps for pretesting (font-lock-extend-region-function), Ralf Angeli, 2006/04/25
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/25