GNU bug report logs -
#71345
Feature: unleash font-lock's secret weapon; handle Qfontified = non-nil
Previous Next
Full log
View this message in rfc822 format
> In my particular case, I've been trying for several months to achieve
> a scheme for position-dependent additional fontification based on treesitter
> scope: think font-lock, but respondent not just to the contents of the
> buffer, but also the location of point within it. My particular application
> is drawing treesitter scope-aware indentation bars. There are many other
> applications you could envision, including many discussed here
> (e.g. bug#22404).
I've been meaning to add support for that to jit-lock.
Here's the design I have in mind:
From the outside, only one change, i.e. a new function
(jit-lock-flush BEG END FONTIFICATION-FUNCTION)
where FONTIFICATION-FUNCTION is the exact same function that was passed
to `jit-lock-register` (and is thus used as a kind of identifier of the
corresponding backend).
So in your case, when the position-dependent highlighting needs to be
updated, you'd request it by calling `jit-lock-flush`.
The way it would be implemented inside `jit-lock.el` is that
`jit-lock-flush` would set `fontified` to nil over that whole region,
but before that it would scan the region for those places where
`fontified` is non-nil, and set the `jit-lock-already-fontified` property
to the list of currently active backends (minus FONTIFICATION-FUNCTION),
so as to remember that while this region does require jit-lock action
those backends don't need to be called.
Then when `jit-lock-fontify-now` is called it will skip those backends
mentioned in `jit-lock-already-fontified`.
Stefan
This bug report was last modified 1 year and 104 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.