[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default
From: |
Stefan Monnier |
Subject: |
bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes |
Date: |
Sat, 16 Nov 2024 11:52:48 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> FWIW, I agree that we should at least remove the recommendation to use
>> `require` on emacs-30, as it encourages bad habits and contributes to an
>> already poor understanding of autoloading among users.
> This all should have been discussed when major-mode-remap-defaults was
> added and c-ts-mode was modified to use it. Not now, sigh.
Yup. I too often focus on the code and skip the doc. 🙁
> Anyway, I don't want to remove the 'require' part from the commentary,
> but I think we should modify it to use 'load', not 'require' (given
> the discussion in bug#74339), and we should make it the second
> alternative, after the one that talks about using
> major-mode-remap-alist.
`load`? Yuck!
But well, better than nothing (tho it likely won't make much difference
in an init file: the problem of later loading `cc-mode` will still bite
just as much).
I don't understand why you insist on suggesting such a "setting" since
it's unreliable now and probably even more so in the future.
What advantage do you see in it for the user over the
`major-mode-remap-alist` option?
> The commit log message says
>
>> (c-ts-mode, c++-ts-mode): Don't suggest remapping `c-or-c++-mode`
>> to `c-or-c++-ts-mode` since `c-or-c++-ts-mode` is deprecated
>> since `c-or-c++-mode` already obeys the remapping of `c/c++-mode`.
>
> However, if we don't remap c-or-c++-mode, it will load cc-mode.el,
> which loads a bunch of other cc-*.el files, which is not clean, since
> all we need is a single regexp.
...and the `c-or-c++-mode` function itself.
Good point.
> (And note that c-ts-mode doesn't limit the search for the regexp,
> whereas cc-mode.el does.)
Should we harmonize the two? Do we know if there's a reason other than
accidental for the difference? Presumably the `cc-mode.el` one has been
more widely tested.
> So I think if we want to _really_ deprecate
> c-or-c++-ts-mode, we should make this variable defined on a separate
> file, common to CC Mode and c-ts-mode, which doesn't load anything
> else. Perhaps in subr.el or files.el.
BTW, there's a similar issue with the `c-string-list-p` and
`c-string-or-string-list-p` functions which are used for
`safe-local-variable` which would cause `cc-vars.el` to be loaded for
`c-ts-mode` users when a `dir-locals.el` sets some `c-mode` vars.
Maybe we should move those things to a small `cc-utils.el` file which
doesn't load other CC-mode files?
[ Currently, this problem is hidden by the fact that we eagerly load
`cc-mode.el` anyway (which also loads `cc-vars.el`) even before we try
to look at those vars's `safe-local-variable` setting. ]
Stefan
- bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes, Stefan Monnier, 2024/11/15
- bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes, Stefan Kangas, 2024/11/15
- bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes, Eli Zaretskii, 2024/11/16
- bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes,
Stefan Monnier <=
- bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes, Eli Zaretskii, 2024/11/16
- bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes, Stefan Monnier, 2024/11/16
- bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes, Eli Zaretskii, 2024/11/16
- bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes, Stefan Monnier, 2024/11/17
- bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes, Eli Zaretskii, 2024/11/18