[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: |
Alan Mackenzie |
Subject: |
Re: Last steps for pretesting (font-lock-extend-region-function) |
Date: |
Tue, 25 Apr 2006 22:16:23 +0000 (GMT) |
Hi, Ralf!
On Tue, 25 Apr 2006, Ralf Angeli wrote:
>* Alan Mackenzie (2006-04-24) writes:
>> after-change-functions is the canonical way of solving problems related
>> to buffer changes. This includes Font Locking.
>But extending the region in the after-change case does not help with
>"normal" fontification by region as e.g. done by jit-lock.
>> I say to you again - your solution is not robust. I don't think it's
>> been tried at all (correct me if I'm wrong).
>Hopefully I understand "your solution" correctly here if I am assuming
>this relates to putting the hook into
>`font-lock-default-fontify-region'.
Yes - more precisely, putting the hook ONLY into f-l-d-f-r.
>I've implemented a variant of this approach for AUCTeX by using a
>custom-made function for `font-lock-fontify-region-function' which calls
>other functions for extending the region and then calls
>`font-lock-default-fontify-region' with the extended region as
>arguments. There is no special code in `after-change-functions' and the
>approach actually works quite well.
>> We are both aware of a refinement which is needed, namely calling some
>> sort of f-l-extend-region-f from f-l-d-f-r and j-l-f-n.
>If putting the hook into `font-lock-default-fontify-region' works
>reliably, why do you need it in `after-change-functions' and
>`jit-lock-fontify-now' as well?
It doesn't work reliably. The region which needs fontification after a
buffer change depends on that _change_, not merely on what the buffer
looks like after the change. If the f-l-extend-region-f isn't called
from after-change-functions, necessary information gets lost. Take, once
more, the standard canonical example:
1: "string \
2: over \
3: several <======= point is here, having just deleted a character.
4: lines."
Point is at EOL 3, having just deleted a character. A hook in
f-l-after-change-functions cannot determine whether L4 belongs to the
region, without knowing whether the deleted character was a \. A hook is
thus necessary in font-lock-after-change-functions too, to record this
information in some fashion.
>Ralf
--
Alan.
- Re: Last steps for pretesting (font-lock-extend-region-function), (continued)
- Re: Last steps for pretesting (font-lock-extend-region-function), Tomas Zerolo, 2006/04/25
- 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), Stefan Monnier, 2006/04/25
- 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), Stefan Monnier, 2006/04/25
- 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), Stefan Monnier, 2006/04/25
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/25
- Re: Last steps for pretesting (font-lock-extend-region-function), Stefan Monnier, 2006/04/26
- Re: Last steps for pretesting (font-lock-extend-region-function), Alan Mackenzie, 2006/04/26
- Re: Last steps for pretesting (font-lock-extend-region-function),
Alan Mackenzie <=
- Re: Last steps for pretesting (font-lock-extend-region-function), Stefan Monnier, 2006/04/26
- RE: Last steps for pretesting (font-lock-extend-region-function), Drew Adams, 2006/04/21
Re: Last steps for pretesting, Richard Stallman, 2006/04/19
Re: Last steps for pretesting, Richard Stallman, 2006/04/24
Re: Last steps for pretesting, Reiner Steib, 2006/04/20
Re: Last steps for pretesting, Ramprasad B, 2006/04/20