[Top][All Lists]

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

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

From: Alan Mackenzie
Subject: Re: font-lock-extend-region-function: Final refinements.
Date: Sun, 6 Aug 2006 14:48:49 +0100
User-agent: Mutt/1.5.9i

Hi, Stefan!

On Fri, Aug 04, 2006 at 10:59:05AM -0400, Stefan Monnier wrote:
> >> > 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.

I don't understand what you're saying here - what is the relevance of
that fact to the way the hook functions get used?

> j-l-after-change-extend-region-functions is a hook provided by jit-lock
> for its client packages.

What do you mean by "client packages" here.  Is this things like
glasses.el?  Does it include font-lock.el, does it include foo-mode.el?
Are you saying that j-l-a-c-extend-region-f is a hook purely for the use
of font-lock itself (i.e. only in the three files font-lock.el,
font-core.el and jit-lock.el)?

> font-lock uses it [j-l-after-change-extend-region-functions] for
> various purposes, including to run its own
> f-l-extend-after-change-function.

I'm fairly confused at the moment, particularly by some of the function
names.  For example, what does the "jit-lock" part of the name
`font-lock-extend-jit-lock-region-after-change' mean?  Does it mean that
this function only gets called when jit-lock is active?  Could you
possibly give these new functions doc strings (or even comments) which
explain the context in which they're called?

> 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).

OK.  I missed the fact that f-l-extend-a-c-function gets called from

But I'm not sure you've answered my question; if you have, I've not
understood the answer.  So let me ask it again: why are there two
separate hooks for extending the region after a buffer change [that's
jit-lock-after-change-region-functions and
font-lock-extend-after-change-region-function]?  What would become more
difficult or impossible if these two were unified into a single hook?
It seems to me that the two (or three) incompatible calling conventions
for these hooks might well cause unnecessary confusion.

Again, would it be possible to simplify the whole mechanism by using
only one of the pairs `font-lock-beg/end' and `jit-lock-start/end'?

>         Stefan


reply via email to

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