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
Alan Mackenzie <acm <at> muc.de> writes:
> On Fri, Nov 15, 2024 at 14:01:26 -0500, Stefan Monnier wrote:
>> > One can write, in the Local Variables: section
>
>> > mode: c-ts
>
>> FWIW, unless this file is personal, this is very bad practice, and not
>> only because `c-ts-mode` may not be available (in older Emacsen or if
>> the user didn't build Emacs with tree-sitter support or doesn't have the
>> appropriate grammar installed): the choice between `c-mode` and
>> `c-ts-mode` is a personal preference, so it's not the file's business to
>> tell the user which mode to use, just like it's not the file's business
>> to tell the user which editor to use.
+1
> Here is a section of a test file sent to bug-cc-mode some while ago:
>
> /*
> ** Local Variables:
> ** mode:c
> ** indent-tabs-mode:nil
> ** c-basic-offset:4
> ** End:
> */
>
> Here it is evident that by "mode:c" the OP means C Mode, not whatever
> random mode happens to have taken the symbol `c-mode'.
Yes, that is how Emacs behaves by default.
However, the point of the new feature, major-mode-remap, is exactly to
allow users to override that. This new feature is optional, and AFAICT
the user choice is explicit and not "random".
Clearly, c-mode is still favored, as it is the default, and many of us
continue being happy users of it even while running a treesitter build.
So this new feature very clearly only affects users that have somehow
explicitly indicated that they want to use c-ts-mode instead.
>> > .. This will cause the buffer to start in c-ts-mode regardless of any
>> > other current settings.
>
>> Actually, no: `major-mode-remap-*` can also remap `c-ts-mode` to some
>> other mode, such as `c-mode`.
>
> Maybe I should have said "regardless of any non-crazy settings".
What makes anything about that setting crazy?
I'd use that setting, if I ever ran into any files with a "-*- c-ts -*-"
cookie. Similarly, I expect that c-ts-mode users will want to use
c-ts-mode precisely when a file has a "-*- c -*-" cookie.
Again, being able to do that is exactly the point of major-mode-remap.
I struggle to understand why that flexibility is controversial. It
puts more power into users' hands, that's all.
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.