GNU bug report logs -
#74339
30.0.92; CC Mode stomps C TS Mode
Previous Next
Reported by: Eli Zaretskii <eliz <at> gnu.org>
Date: Wed, 13 Nov 2024 14:02:02 UTC
Severity: normal
Found in version 30.0.92
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> I've now made changes in c-ts-mode.el on the emacs-30 branch that
> allow to remap CC Mode's C/C++ modes to the corresponding tree-sitter
> based modes as result of loading c-ts-mode, which resolves this bug.
> (cc-mode.el remains unchanged, so loading cc-mode will revert to using
> CC Mode, as it did before this change. IOW, the changes I installed
> make it possible for users to prefer c-ts-mode if they want, and leave
> intact the ability of users to prefer cc-mode if that is what they
> want.)
This does help a user insist on c-mode rather than c-ts-mode.
However, setting that switch by loading file A or file B is not
natural. In Emacs we try to have a user option to control such a
choice.
How about making a user option that will be tested on every occasion
whet it is time to put a buffer in one of those modes?
The simplest way is to call the option `c-mode-use-tree-sitter'. I
think a similar option will be needed for each major mode that has a
TS counterpart. We could have an option like that for each of those
major modes.
Other user interfaces involving a single option to specify which
modes should get tree-sitter handling can be considered.
I think the goals are
(1) the Customize interface should handle these options cleanly.
(2) a user should be able to set this just once, and the setting will
stick in future Emacs versions (unless the user explicitly changes it)
as long as this aspect of Emacs doesn't fundamentally change.
There could also be a command M-x major-mode-use-tree-sitter which
would toggle that switch for the current major mode. So if you use
that command while in a C mode buffer, it would change the value of
`c-mode-use-tree-sitter'. Perhaps it would also change the major mode
in each buffer that uses `c-mode' or `c-ts-mode'.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
This bug report was last modified 252 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.