--- Begin Message ---
Subject: |
CC Mode fontification bug |
Date: |
Sun, 31 Jul 2022 00:16:37 +0000 |
Recipe:
emacs -Q
C-x C-f src/xdisp.c RET
M-g c 28 RET
;; take note of the word there: "window"
M-: (get-char-property 28 'fontified) RET
;; observe that this returns t
M-g g 800 RET
C-v
M-: (get-char-property 28 'fontified) RET
;; observe that this returns nil, because "struct window" is now visible
This is a BUG.
When font locking has put a fontified property and one of the
font-lock-*-faces on characters in the buffer, a mode should not undo that
unless it has a very good reason to do so. Otherwise scrolling again
through an already fontified buffer calls fontification functions again
without reason.
Patch attached.
With the patch, scrolling again through an already fontified buffer is
~25% faster.
Be-conservative-with-occurrences-of-newly-found-types.patch
Description: Text Data
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#56848: CC Mode fontification bug |
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).
--- End Message ---