[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: Mon, 7 Aug 2006 23:49:15 +0100
User-agent: Mutt/1.5.9i

Evening, Stefan!

On Mon, Aug 07, 2006 at 01:45:02PM -0400, Stefan Monnier wrote:

[ .... ]

> If you mean a major mode "Foo", then no: major modes typically don't
> use jit-lock: they use font-lock (which may or may not internally use
> jit-lock, but that's mostly none of their business, unless they fiddle
> with font-lock-support-mode).


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

> And glasses.el, yes.

glasses.el is a really neat mode!

> > 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?

> Yes.

> > Could you possibly give these new functions doc strings (or even
> > comments) which explain the context in which they're called?

> It's on the way.


> > 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]?

> Because you can use jit-lock without font-lock and vice-versa.  One is
> for jit-lock clients (e.g. font-lock), and the other for font-lock
> clients (e.g. c-mode).

EUREKA!!!  I hadn't realised that jit-lock could be used for things other
than fontification.  You just have to stuff a different function, such as
the glasses one, into `jit-lock-functions'.  Thanks for the

Actually, there are places, quite a lot of them, in jit-lock.el (e.g. the
doc string for j-l-after-change-extend-r-f) which explicitly refer to
fontification.  Maybe these could be reformulated with words more
accurate and more abstract than "fontify".

> > 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'?

> Why would you care?
> c-mode should never need to know about jit-lock-(beg|end).

I'm happy about that!

>         Stefan


reply via email to

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