[Top][All Lists]

[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: Wed, 11 Jan 2023 09:27:28 +0000

Previously, CC Mode fontification was missing some types. Judge for yourself what is better: missing types, or randomly adding types?

That's the problem. Clearly you prefer the former (all bug reports in the long list that Alan shared were filed by you), and others prefer the latter. There is a tension between fontifying too few identifiers with a type face and fontifying too many identifiers with a type face. And that problem cannot have an accurate solution without a parser. (In fact, even a parser is not enough for that job if you want 100% accuracy.)

Note that this can easily be fixed with C-u C-x x f C-x x f.

Or re-enabling C Mode. Both of which are annoying things that weren't necessary in Emacs 28.

Alan did not add a defcustom around that new feature (and rightly so, AFAIU), but you can also turn it off with a single short line in your init file:

(advice-add #'c-fontify-new-found-type :override #'ignore)

It worked in Emacs 28, 27, and since before that, because it really is not vital for CC Mode to proactively look for types.

Evidently that's your opinion and preference, and it's not what others prefer: they are more annoyed by type identifiers that remain unfontified than by occasional fontification of non-type identifiers as types.

AFAIU tree-sitter has the same problem: it does not understand typedefs previously encountered in a buffer

Yes, as I said above if you want 100% accuracy, you need more than a parser, you need a full compiler.

In the meantime, the so-called ``fontification based on an actual parser'' does not even understand traditional C code. Last I checked, it also had problems indenting the Motif WM hints structure that people copy everywhere.

Sorry, I don't understand what you mean by this, or how it is related to the problem at hand.

reply via email to

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