Subject: Re: bug#56848: CC Mode fontification bug

From: Alan Mackenzie <[email-masked]>
Date: Sun, 15 Jan 2023 12:32:31 +0000

reopen 56848
quit

Hello, Gregory.

Thanks for the Cc:!

I'm (trying to) reopen the bug with this post.

On Sat, Jan 14, 2023 at 21:28:24 +0000, Gregory Heytings wrote:

> Closing this bug.  The proposed patch has been included in commits 
> 4bd8ad2bc5 and 1cbc22b9c7.

I wasn't previously aware of this bug.  I'm not at all happy about the
patches you proposed and have applied.  In particular, you say
(2022-07-31):

> When font locking has already put, say, a font-lock-comment-face, or a
> font-lock-function-name-face, or a font-lock-variable-name-face on an
> occurrence of that identifier, there is no reason to undo that.  It is
> only occurrences that have been marked as "fontified" but on which no
> face has been put that should be unfontified.

, without justification.  There are circumstances in which identifiers
with font-lock-type-face need to be refontified with
font-lock-variable-face, and the reverse, amongs others.  It was trying
to optimise in this area which caused some of Po Lu's bug reports over
the last three months.

An example of what can go wrong is, supposing we have just mistyped

    food sausage;

as

    foo sausage;

..  "All" the identifiers "foo" throughout the buffer will get fontified
with type-face.  On returning to the line and correcting "foo" to
"food", these "foo"s need to be refontified.  This actual scenario
occurred in one of Po's bug reports.

I think that after the patches in this bug, the refontification won't
happen.  I've reopened the bug, and I'm asking you to reconsider these
things.

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).