GNU bug report logs -
#56848
CC Mode fontification bug
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sun, 15 Jan 2023 12:32:31 +0000
with message-id <Y8PyX9jH/utJbUXc <at> ACM>
and subject line Re: bug#56848: CC Mode fontification bug
has caused the debbugs.gnu.org bug report #56848,
regarding CC Mode fontification bug
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
56848: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56848
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
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 (text/x-diff, attachment)]
[Message part 5 (message/rfc822, inline)]
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).
This bug report was last modified 2 years and 123 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.