[Top][All Lists]

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

Re: Partly deferred font-locking?

From: Eli Zaretskii
Subject: Re: Partly deferred font-locking?
Date: Thu, 12 Jan 2023 15:45:57 +0200

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Date: Thu, 12 Jan 2023 14:14:15 +0100
> If you wanted to add some more expensive on-the-fly highlighting, how
> would you do it?

AFAIU, it would require changes in jit-lock.el and perhaps also in the
display engine.

But I'm not sure we are on the same page regarding what you'd like to
see, exactly.  In particular, what do you mean by "deferred
highlighting"? when would the "deferred" part be done?

Both jit-lock-defer-time and jit-lock-stealth-time defer highlighting
to when enough idle time has passed since last command.  Is that what
you want -- to be able to complement the highlighting by more
highlighting?  If so, you'd need to change the 'fontified' property to
have more than just a boolean value, and you'd need a special timer
which examined the 'fontified' property and applied more highlighting
if the value says it wasn't applied yet.

> Currently, one can't use font-lock directly: when the additional deferred
> highlighting doesn't happen for a buffer chunk but normal font-locking
> was performed, the deferred highlighting would not be triggered again
> when that buffer area gets visible again.
> So I think I would have to remember which parts of the buffer where
> treated by the deferred highlighting by myself, I would have to keep
> that information in an additional variable.  That feels a bit odd
> since this is one of the things that font-lock naturally does.
> I need to reinvent parts of font-lock.

See above: no need to reinvent, but the property needs to record the
fact of "partial" highlighting, and you need a new timer to apply the
"expensive" highlighting under whatever conditions you decide are

Please note that expensive highlighting might make Emacs less

reply via email to

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