[Top][All Lists]

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

Re: something like linum.el ought to be added

From: Stefan Monnier
Subject: Re: something like linum.el ought to be added
Date: Fri, 14 Sep 2007 13:20:20 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

> Some comments on the idea of relying on fontification-functions:

> I think linum.el should work even if the user has font-locking turned
> off, so it shouldn't depend on jit-lock.el (unless jit-lock can be
> used without turning font-locking on?).  Anyway, the whole
> font-locking subsystem is also quite hard to understand, so it seems
> unwise to me to get linum.el tied up in that complexity.  And
> font-locking is oriented toward fontifying the entire buffer
> eventually while with line numbering you probably only want to keep
> active overlays for the displayed region.

You may want to take another look at jit-lock-register.  Or glasses-mode for
that matter (the only other user of jit-lock currently besides font-lock).

But yes: jit-lock is oriented towards fontifying the whole buffer, which is
not what linum.el wants to do (and actually glasses-mode would probably
rather be like linum.el).

> And it seems it would be hard for fontification-functions will work
> well with linum.el as a separate user from jit-lock.el, because they
> would both be competing for control of the same fontified property.
> So, for example, if stealth background fontification fontified some
> region, it would (I think?) place a non-nil value on the fontified
> property of that region, and then when that region was displayed by
> scrolling there would be nothing to trigger the line numbering.

Yes, that's the problem I hinted at which makes it pretty much impossible to
use multiple functions on fontification-functions.

So I think it's fine for linum.el to use something else, but I do think it's
a good opportunity also to revisit this jit-lock and fontification-functions
business to try and come up with a good solution.

Maybe a solution is to change jit-lock by having it distinguish between
clients that would rather keep everything fontified (full clients) and those
that would rather only keep the displayed part fontified (light clients).

Then add a jit-lock-clear-unused thingy that would go and flush all the
non-displayed data of the light clients and then set fontified to nil (so
that jit-lock gets to know when those need to be prepared for display), but
also set jit-lock-fontified to t (so that jit-lock knows that this was
already fontified w.r.t full clients, so only light clients need to be


reply via email to

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