emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: font-lock-extend-region-function: Final refinements.


From: Stefan Monnier
Subject: Re: font-lock-extend-region-function: Final refinements.
Date: Fri, 04 Aug 2006 10:59:05 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> > One small point - there are slightly different mechanisms in
>> > jit-lock-after-change and font-lock-after-change-function for
>> > extending the region.  Is there a reason for this?

>> Yes.

>> Basically here is what happens in f-l-after-change:
>> A1 - obey f-l-extend-after-change-function.

>> Here is what happens in j-l-after-change (via
>> f-l-extend-jit-lock-region-after-change):
>> B1 - obey f-l-extend-after-change-function.
>> B2 - obey font-lock-multiline (just once: no looping).
>> B3 - round up to whole lines.

>> - A1 == B1.

> That's not quite true.  B1 uses j-l-after-change-extend-region-functions,
> which has the same purpose as f-l-extend-after-change-function, but a
> different calling convention.  I can't see any reason why these two need
> to be different - it seems to be an unnecessary complication.

jit-lock.el is a package that provides a service used by font-lock.el and
glasses.el and potentially many more packages.  Do a grep for `font-lock'
in jit-lock.el and you'll see that it's only mentioned in docstrings
and comments.
j-l-after-change-extend-region-functions is a hook provided by jit-lock
for its client packages.  font-lock uses it for various purposes, including
to run its own f-l-extend-after-change-function.

I.e. j-l-after-change-extend-region-functions should *not* be used by major
modes for their font-lock needs.  There's f-l-extend-after-change-function
for that (with the added advantage that it also works when font-lock doesn't
use jit-lock).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]