[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#74339: 30.0.92; CC Mode stomps C TS Mode
From: |
Alan Mackenzie |
Subject: |
bug#74339: 30.0.92; CC Mode stomps C TS Mode |
Date: |
Thu, 14 Nov 2024 16:20:37 +0000 |
Hello, Eli.
On Thu, Nov 14, 2024 at 08:59:32 +0200, Eli Zaretskii wrote:
> > Date: Wed, 13 Nov 2024 22:34:19 +0000
> > Cc: 74339@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>,
> > acm@muc.de
> > From: Alan Mackenzie <acm@muc.de>
[ .... ]
> > Can I take it that you will respect the choice of users who wish to
> > remain on CC Mode as much as those who wish the new tree-sitter modes?
> Of course! That's what happens by default if the user didn't load
> c-ts-mode, and (under my suggested idea of a change) will happen if
> the user loads cc-mode after loading c-ts-mode. IOW, the last mode
> loaded will "win".
This is also not ideal, in that M-x c-ts-mode will mostly not change the
preferred mode, but will do if it causes an autoload. I've been trying
to think up something better, but all that springs to mind would be two
commands `cc-mode-prefer' and `c-ts-mode-prefer'.
> > > If the user prefers to use c-ts-mode, then revert-buffer _should_ use
> > > c-ts-mode, not c-mode. The same happens if you change the way
> > > normal-mode determines the mode and then revert the buffer. This
> > > change in what revert-buffer does is now another user expectation your
> > > change has broken, and it, too, must be fixed.
> > And if a user has made no such choice, normal-mode will forcibly change
> > the major modes of their buffers, whether they like it or not.
> No, it won't. This could happen only if the user loads c-ts-mode
> in-between, which means the user prefers c-ts-mode. Without that,
> normal-mode will always revert to c-mode in the default Emacs
> configuration.
> > > I'm not interested in having revert-buffer ignore user preferences of
> > > using c-ts-mode, .....
> > Instead Emacs ignores the perfectly reasonable preference to have
> > buffers modes stay the same as when the user set them.
> Reverting the buffer activates whatever major mode corresponds to the
> file name and other relevant settings at the moment of the reverting.
> If you modify those settings in-between, it is quite possible (and
> expected!) that normal-mode will activate a different mode. This is
> how Emacs always behaved (and should keep behaving). Anything else is
> against user expectations.
OK, let's agree to disagree on this one. As a user, when I was comparing
the two modes, I got annoyed at Emacs continually changing my major
modes. I may not be the only one. Maybe (for Emacs 31?) there could be
a user option to control this.
> > > If we can fix Emacs to behave like I described, i.e. return to the
> > > state where C/C++ files are visited in cc-mode rather than in
> > > c-ts-mode, just by reloading cc-mode, would you agree with such a fix?
> > I think so, provided there was symmetry between the tree-sitter modes and
> > CC Mode. I would suggest the obvious fix; loading either one of the
> > libraries should append its entries to auto-mode-alist, having removed
> > any "lower down" entries.
> That's what I suggested. If you agree, let's make that change and
> move on.
OK. It would seem there is then no need to put entries for
c-mode/c-ts-mode into major-mode-remap-defaults. I don't think this
solution is optimal, though. Perhaps we can come up with something
better for Emacs 31. But let's just go with this "last loaded wins"
strategem for Emacs 30.
--
Alan Mackenzie (Nuremberg, Germany).
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, (continued)
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Stefan Monnier, 2024/11/13
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Eli Zaretskii, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Dmitry Gutov, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Eli Zaretskii, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Stefan Monnier, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Dmitry Gutov, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Eli Zaretskii, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Stefan Monnier, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Eli Zaretskii, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Stefan Monnier, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode,
Alan Mackenzie <=
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Eli Zaretskii, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Alan Mackenzie, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Stefan Monnier, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Eli Zaretskii, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Alan Mackenzie, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Eli Zaretskii, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Alan Mackenzie, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Stefan Monnier, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Stefan Monnier, 2024/11/14
- bug#74339: 30.0.92; CC Mode stomps C TS Mode, Eli Zaretskii, 2024/11/15