unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: rms@gnu.org
Cc: 74339@debbugs.gnu.org
Subject: bug#74339: 30.0.92; CC Mode stomps C TS Mode
Date: Sun, 24 Nov 2024 09:41:29 +0200	[thread overview]
Message-ID: <86ttbxjcye.fsf@gnu.org> (raw)
In-Reply-To: <E1tF4L0-0003d0-Fd@fencepost.gnu.org> (message from Richard Stallman on Sat, 23 Nov 2024 23:35:10 -0500)

> From: Richard Stallman <rms@gnu.org>
> Cc: 74339@debbugs.gnu.org
> Date: Sat, 23 Nov 2024 23:35:10 -0500
> 
>   > I've now made changes in c-ts-mode.el on the emacs-30 branch that
>   > allow to remap CC Mode's C/C++ modes to the corresponding tree-sitter
>   > based modes as result of loading c-ts-mode, which resolves this bug.
>   > (cc-mode.el remains unchanged, so loading cc-mode will revert to using
>   > CC Mode, as it did before this change.  IOW, the changes I installed
>   > make it possible for users to prefer c-ts-mode if they want, and leave
>   > intact the ability of users to prefer cc-mode if that is what they
>   > want.)
> 
> This does help a user insist on c-mode rather than c-ts-mode.
> However, setting that switch by loading file A or file B is not
> natural.  In Emacs we try to have a user option to control such a
> choice.
> 
> How about making a user option that will be tested on every occasion
> whet it is time to put a buffer in one of those modes?

It's more complicated than that.  The situation where more than one
major mode is appropriate for certain contents of a buffer is new in
Emacs, we first encountered it in Emacs 29, quite close to its
release.  The solution took a couple of iterations, but eventually I
decided that loading a mode will be the best alternative in the short
term, although it has known issues.

We are currently discussing the possible improvements, which include
user option and more, in this thread:

  https://lists.gnu.org/archive/html/emacs-devel/2024-11/msg00636.html

> The simplest way is to call the option `c-mode-use-tree-sitter'.  I
> think a similar option will be needed for each major mode that has a
> TS counterpart.  We could have an option like that for each of those
> major modes.

That is one possibility, but I'm not sure it's the best one.  For
example, if the user wants to prefer several such modes, calling a
command for each one of them would be a nuisance.  Also, having a
separate command for each mode makes this harder to remember.

There are also some issues regarding the implementation that we need
to figure out.

> Other user interfaces involving a single option to specify which
> modes should get tree-sitter handling can be considered.
> I think the goals are
> 
> (1) the Customize interface should handle these options cleanly.
> 
> (2) a user should be able to set this just once, and the setting will
> stick in future Emacs versions (unless the user explicitly changes it)
> as long as this aspect of Emacs doesn't fundamentally change.
> 
> There could also be a command M-x major-mode-use-tree-sitter which
> would toggle that switch for the current major mode.  So if you use
> that command while in a C mode buffer, it would change the value of
> `c-mode-use-tree-sitter'.  Perhaps it would also change the major mode
> in each buffer that uses `c-mode' or `c-ts-mode'.

All of this (and more) is in scope of the above discussion.  I hope we
will have a much better solution for this in Emacs 31.





  reply	other threads:[~2024-11-24  7:41 UTC|newest]

Thread overview: 85+ 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
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-23 19:40                       ` Eli Zaretskii
2024-11-24  2:56                         ` Dmitry Gutov
2024-11-24  5:27                           ` Eli Zaretskii
2024-11-25  1:16                             ` Dmitry Gutov
2024-11-25 12:11                               ` Eli Zaretskii
2024-11-25 23:40                                 ` Dmitry Gutov
2024-11-26 14:26                                   ` Eli Zaretskii
2024-11-26 22:06                                     ` Dmitry Gutov
2024-11-27  3:28                                       ` Eli Zaretskii
2024-11-27 12:34                                         ` Dmitry Gutov
2024-11-24 15:37                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-24 16:01                           ` Christopher Dimech via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-24 16:30                             ` Eli Zaretskii
2024-11-24 16:27                           ` Eli Zaretskii
2024-11-24 16:47                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-25  0:57                               ` Dmitry Gutov
2024-11-24  4:35                   ` Richard Stallman
2024-11-24  7:41                     ` Eli Zaretskii [this message]
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=86ttbxjcye.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=74339@debbugs.gnu.org \
    --cc=rms@gnu.org \
    /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).