unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: acm@muc.de, 74367@debbugs.gnu.org, stefankangas@gmail.com
Subject: bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes
Date: Sat, 16 Nov 2024 20:35:25 +0200	[thread overview]
Message-ID: <86plmvf2mq.fsf@gnu.org> (raw)
In-Reply-To: <jwvbjyfp2al.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Sat, 16 Nov 2024 11:52:48 -0500)

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Stefan Kangas <stefankangas@gmail.com>,  74367@debbugs.gnu.org, Alan
>  Mackenzie <acm@muc.de>
> Date: Sat, 16 Nov 2024 11:52:48 -0500
> 
> > 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.

Because that's what users did in Emacs 29.  I don't want us to make an
impression it no longer works.

> What advantage do you see in it for the user over the
> `major-mode-remap-alist` option?

Since I agreed to make the major-mode-remap-alist the first item, is
there still a question of the advantages of 'load' wrt
major-mode-remap-alist?

> > 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.

I don't mind limiting the search in c-ts-mode, but then we need two
common variables.

> > 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.

I think we should have a string-or-list-p function in subr.el, like
string-or-null-p we already have there.

> Maybe we should move those things to a small `cc-utils.el` file which
> doesn't load other CC-mode files?

That would also work for me.





  reply	other threads:[~2024-11-16 18:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15 16:45 bug#74367: [PATCH] c-ts-mode.el: Adjust doc about how to change default modes Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 21:15 ` Stefan Kangas
2024-11-16 10:59   ` Eli Zaretskii
2024-11-16 16:52     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 18:35       ` Eli Zaretskii [this message]
2024-11-16 20:26         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 21:00           ` Eli Zaretskii
2024-11-17 22:19             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-18 12:09               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86plmvf2mq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=74367@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).