Subject: Re: bug#77054: Completion highlighting applied outside completion-lazy-hilit-fn

From: João Távora <[email-masked]>
Date: Thu, 20 Mar 2025 17:11:36 +0000

On Thu, Mar 20, 2025, 12:20 Eli Zaretskii <[email-masked]> wrote:

> >
> > If it helps, I can reframe this bug report as: if lazy highlighting is
> > enabled, can Emacs perform additional fontification (outside the
> > completion frontend and style)?
>
> I believe the answer is YES; if you would like to _replace_ the
> fontifications of the candidate, your function should remove the face
> text properties from all the characters of the string, before adding
> your fontifications.
>

The function may do this and it's passed a fresh string to destroy at will
I think, but it may not matter if later parts of the machinery add these
properties. It could come from the table's sorting for example. There's
little the style can do about that.

Furthermore, as I've been trying to explain, lazy highlighting as I
implemented is completely orthogonal. It's just a mechanism to allow front
ends to delay fontification to the last possible moment when they actually
display stuff to the user. Styles are not supposed to set it to anything
that fontifies differently/specially because styles don't know in general
what frontend is driving them. IOW, whatever problem the OP is experiencing
would likely be there if lazy highlighting were turned off (by the frontend
or the style, or both).

João