GNU bug report logs - #71345
Feature: unleash font-lock's secret weapon; handle Qfontified = non-nil

Previous Next

Package: emacs;

Reported by: JD Smith <jdtsmith <at> gmail.com>

Date: Mon, 3 Jun 2024 16:36:02 UTC

Severity: normal

Full log


Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: JD Smith <jdtsmith <at> gmail.com>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, bug-gnu-emacs <at> gnu.org
Subject: Re: Feature: unleash font-lock's secret weapon; handle Qfontified =
 non-nil
Date: Mon, 03 Jun 2024 21:44:36 -0400
> Thanks.  Very interesting approach, recycling the existing Qfontified
> handler.  I wonder though, if you have several different unrelated functions
> calling `jit-lock-flush' with different FONTIFICATION-FUNCTION's prior to
> jit-lock-fontify-now running on a region, won't they step on each other?

Not if `jit-lock.el` handles it correctly, no.

> I.e it seems that you would need to look for existing
> jit-lock-already-fontified+fontified=nil properties over the region
> mentioned in jit-lock-flush and subtract the passed FONTIFICATION-FUNCTION
> from the various values already found there.

Yes, of course.

> Of course you'd also need to handle the case where you "subtract it
> all the way to nil".

I don't think you'd need to do anything special for this case.

> That starts to sound like a lot of property slinging, which might even
> dominate the work done.

Indeed, this amount of work could become significant.  It's my main
worry, but I don't have a clear feel for how serious it would be
in practice.

We could try and unify `fontified` and `jit-lock-already-fontified` by
having a `fontified-done-value` variable and making the redisplay call
jit-lock whenever `fontified` has a value that's not-eq from
`fontified-done-value`.

So jit-lock would set `fontified-done-value` to the list of backends.

> I imagine that the functions may also need a way to opt-out of "deferred
> contextual refontification", for example if they add some other
> properties/overlays orthogonal to face.

`jit-lock.el` already has that info (it's the second arg to
`jit-lock-register`), but it currently doesn't keep track of it
individually for each backend.


        Stefan





This bug report was last modified 1 year and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.