unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	74339@debbugs.gnu.org
Subject: bug#74339: 30.0.92; CC Mode stomps C TS Mode
Date: Sat, 16 Nov 2024 18:17:08 +0000	[thread overview]
Message-ID: <ZzjhpK8k-98M3EZt@MAC.fritz.box> (raw)
In-Reply-To: <CADwFkmk=ZpnOaPJ+Qb67WVPWFkcwQHP6_Z-mqiy=QgGO5w028Q@mail.gmail.com>

Hello, Stefan.

On Fri, Nov 15, 2024 at 19:22:47 -0800, Stefan Kangas wrote:
> Alan Mackenzie <acm@muc.de> writes:

> > That "somehow" is the loading of c-ts-mode.  I think that even C-h f
> > c-ts-mode counts as an "explicit indication" of a supposed preference for
> > c-ts-mode, given that it loads c-ts-mode (if it actually does).

> It seems like you're right about that, in emacs -Q.

> FWIW, I consider that less than ideal, and would prefer that we did that
> only when enabling the mode.  Loading files shouldn't change behaviour,
> exactly for this reason.  So I'd be in favor of making such a change (on
> master).  But that's me.

We could perhaps talk about this again after the release of Emacs 30.

> > I don't think the current mechanism is ready for the release of Emacs 30.
> > It hasn't been thought through thoroughly.

> I see no release blocker at this late stage, myself.

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

> > We don't have fine enough control.  /* mode: c */ followed by /*
> > c-basic-offset: 4 */ in the Local Variables: section is a sure sign that
> > C Mode is intended, not a random C handling mode.

> > What I think we're lacking is an explicit setting or command for the user
> > to state what her preferred mode for C actually is.
> > major-mode-remap-alist isn't that setting - it's too involved, too
> > awkward, and it talks about "remappinig modes" (its internal mechanism)
> > rather than the user's preferred Mode for C.

> I think `major-mode-remap-alist` is the explicit setting that we have.
> That said, I wouldn't personally close the door to a proposal that is
> significantly better.  I'm just not sure what it would look like.

> > What we need is a defcustom 3-valued radio-button defaulting to "no
> > explicit preference", and having other values "c-mode" and
> > "c-ts-mode".

> The benefit of `major-mode-remap` is that it's sufficiently general not
> just for c-mode/c-ts-mode, but for all other cases where we have two or
> more modes, such as yaml-mode/yaml-ts-mode, etc.  And it will handle
> whatever new modes we can dream up in the future.

> It also fits in nicely with the equally general `auto-mode-alist`,
> `interpreter-mode-alist`, etc., that we already have.

> For these reasons, I think I prefer `major-mode-remap` to a specific
> option just for c-mode/c-ts-mode.

I was thinking more of a macro which would create the option mechanism
for any such mode, and which wouldn't have to make a user consider
"remapping".

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

> > It involves c-ts-mode purloining CC Mode's symbols for its own use.  If a
> > user wishes to use major-mode-remap-alist for that, that's one thing -
> > having it done by default in major-mode-remap-defaults by Emacs is
> > something quite different, which I think is unacceptable.

> So you don't like the specific detail that it overloads the use of the
> symbol `c-mode` as a proxy for saying C files?

Indeed not.  It weakens the prime purpose of those names, which is to
identify and call those modes in CC Mode.  Should `c-mode' get the
meaning "any old mode which handles C", then there will be no unambiguous
way for an elisp programmer to refer to c-mode.  c-mode has no other
name, and nobody has suggested giving it one.  Names are important, and
have power.  If somebody used "Stefan Kangas" to refer to some other
person, you would not like it either.

> FWIW, and AFAIR, I think we discussed this overloading of the mode name
> on the list, and the other option ....

_One_ other option.  There were presumably several.

> .... was to introduce a new concept of "languages" into Emacs Lisp,
> where we would have had alist entries like `(c . c-mode)` instead.  The
> conclusion was that doing that would be more complex and it was hard to
> justify this complication.  I can't remember that any other ways to
> avoid this overloading were suggested.

Had I been invited to this discussion, I would certainly have suggested
some other way(s), as I have done recently in this thread.  The current
discussion would then not need to have taken place.

Could you give me some coordinates for the discussion, please?  Back in
May, when I committed the patch that has proven so unpopular, I searched
for such a discussion, but couldn't find it.

-- 
Alan Mackenzie (Nuremberg, Germany).





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

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13 14:00 bug#74339: 30.0.92; CC Mode stomps C TS Mode Eli Zaretskii
2024-11-13 15:13 ` Eli Zaretskii
2024-11-13 18:58 ` Alan Mackenzie
2024-11-13 20:13   ` Eli Zaretskii
2024-11-13 22:34     ` Alan Mackenzie
2024-11-13 22:57       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14  6:59       ` Eli Zaretskii
2024-11-14  9:24         ` Dmitry Gutov
2024-11-14 10:05           ` Eli Zaretskii
2024-11-16 20:54             ` Andrea Corallo
2024-11-14 15:51           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 16:29             ` Dmitry Gutov
2024-11-14 16:49             ` Eli Zaretskii
2024-11-14 17:16               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 19:10                 ` Eli Zaretskii
2024-11-14 19:45                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 16:20         ` Alan Mackenzie
2024-11-14 16:59           ` Eli Zaretskii
2024-11-14 17:45             ` Alan Mackenzie
2024-11-14 17:52               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 19:23               ` Eli Zaretskii
2024-11-14 19:53                 ` Alan Mackenzie
2024-11-14 20:21                   ` Eli Zaretskii
2024-11-14 20:38                     ` Alan Mackenzie
2024-11-14 21:06                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 21:26                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15  8:17                           ` Eli Zaretskii
2024-11-15 16:17                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15  8:13                         ` Eli Zaretskii
2024-11-15  7:33                       ` Eli Zaretskii
2024-11-15 13:04                         ` Alan Mackenzie
2024-11-15 14:43                           ` Eli Zaretskii
2024-11-15 17:58                             ` Alan Mackenzie
2024-11-15 19:01                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 19:46                                 ` Alan Mackenzie
2024-11-15 20:45                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 10:25                                     ` Eli Zaretskii
2024-11-16 14:03                                       ` Stefan Kangas
2024-11-16 14:35                                         ` Eli Zaretskii
2024-11-15 20:58                                   ` Stefan Kangas
2024-11-15 21:56                                     ` Alan Mackenzie
2024-11-16  3:22                                       ` Stefan Kangas
2024-11-16 11:45                                         ` Eli Zaretskii
2024-11-16 18:17                                         ` Alan Mackenzie [this message]
2024-11-16  6:17                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16  8:18                                         ` Eli Zaretskii
     [not found]                                           ` <Zzi86KPmTv1Qb3nw@MAC.fritz.box>
     [not found]                                             ` <86ttc7f7jo.fsf@gnu.org>
2024-11-16 21:56                                               ` Alan Mackenzie
2024-11-17  6:31                                                 ` Eli Zaretskii
2024-11-16  9:52                                   ` Eli Zaretskii
2024-11-15 18:57                           ` Dmitry Gutov
2024-11-21  7:57                 ` Eli Zaretskii
2024-11-21 13:57                   ` Alan Mackenzie
2024-11-21 19:02                   ` Dmitry Gutov
2024-11-21 19:48                     ` Eli Zaretskii
2024-11-14 17:29           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 19:20             ` Eli Zaretskii
2024-11-14 19:38               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 20:37                 ` Eli Zaretskii
2024-11-14 20:58                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-14 22:06                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 12:02                       ` Eli Zaretskii
2024-11-15  7:58                     ` Eli Zaretskii
2024-11-15 16:12                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-16 20:51       ` Andrea Corallo
2024-11-13 20:28 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-13 20:42   ` Eli Zaretskii
2024-11-13 20:46     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=ZzjhpK8k-98M3EZt@MAC.fritz.box \
    --to=acm@muc.de \
    --cc=74339@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --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).