emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CC Mode troubles and Emacs 29


From: Gregory Heytings
Subject: Re: CC Mode troubles and Emacs 29
Date: Tue, 10 Jan 2023 14:13:27 +0000



If this is so, I find it strange that we don't have heaps of bug reports about this in our bug tracker. I doubt that anyone could ignore the terrible misbehavior you describe, if indeed the description is accurate and not exaggerated.


It's indeed exaggerated, AFAIU. Basically, it's an effect of the c-fontify-new-found-type function, which was added to CC Mode in Oct 2021 because of this thread: https://lists.gnu.org/archive/html/emacs-devel/2021-06/msg00174.html. A simple recipe is this:

emacs -Q
C-x C-f foo.c

and type:

int main () { int foo; foo = 1; }
typedef foo SPC

Now 'foo' in 'foo = 1' is fontified in green, because CC Mode considers that 'foo' is a type. If you now realize that 'foo' is a typo, and that what you actually meant is 'foobar', and correct that typo with DEL bar, 'foo' in 'foo = 1' does not loose its type fontification. And if you do that often enough, in the end the buffer is "filled with green splotches". Note that this can easily be fixed with C-u C-x x f C-x x f.

It's actually a nice example of the inherent limits of a fontification that is not based on an actual parser.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]