unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org, theo@thornhill.no
Subject: Re: Tree-sitter and major mode inheritance
Date: Sun, 20 Nov 2022 09:05:12 +0200	[thread overview]
Message-ID: <83bkp26r87.fsf@gnu.org> (raw)
In-Reply-To: <1FE7635A-F90F-4198-AC97-922BA312C305@gmail.com> (message from Yuan Fu on Sat, 19 Nov 2022 13:45:41 -0800)

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 19 Nov 2022 13:45:41 -0800
> Cc: monnier@iro.umontreal.ca,
>  emacs-devel@gnu.org,
>  theo@thornhill.no
> 
> 
> 
> > On Nov 19, 2022, at 9:52 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > 
> >> From: Yuan Fu <casouri@gmail.com>
> >> Date: Sat, 19 Nov 2022 09:17:11 -0800
> >> Cc: Eli Zaretskii <eliz@gnu.org>,
> >> emacs-devel@gnu.org,
> >> theo@thornhill.no
> >> 
> >> If we are already renaming existing modes (cc-<foo>-mode), why don’t we use the generic name <foo>-mode for the virtual parent mode? It would be nicer if the generic mode (<foo>-mode) is an actual mode, with mode hooks, keycaps, etc, rather than simply a dispatch function.
> > 
> > I already said that I prefer not to rename existing modes.  Such
> > renaming will break too many init files and other Lisp programs.
> 
> I guess we can at least try it for a bit?

"Try" in what way?

> Because hook, keymaps, etc, should just work, that’s the point of major mode inheritance, after all. C-native-mode will run all the setup for c-mode, plus setup for c-native-mode.

Renaming public symbols is BAAAAD!  It causes breakage for many users and
Lisp programs.  It will either cause large-scale renaming of hooks, keymaps,
etc., which will break user init files; or it will cause confusion (because
a hook for cc-FOO-mode will be called cc-mode-hook and not the expected
cc-FOO-mode-hook).  And that is just the tip of the iceberg.

Why cannot we have the solution we already discussed and agreed upon:

  . modes that didn't exist before Emacs 29 will require tree-sitter
  . modes that existed before Emacs 29 will either
    - offer tree-sitter support as an optional feature, via a minor mode or
      a defcustom; or
    - add a completely new major mode with a different name that requires
      tree-sitter

If you need to add a FOO-base-mode to make it easier to share between
tree-sitter and non-tree-sitter modes features that are common to both, it's
fine with me to add such *-base-modes, but they should not be in any
auto-mode alist, and should generally be only an implementation detail
mostly hidden from users.

What is the problem with the above?  I thought we already agreed on that, so
how come this issue pops up time and again?



  reply	other threads:[~2022-11-20  7:05 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 20:45 Tree-sitter and major mode inheritance Yuan Fu
2022-11-18 21:54 ` Suggesting that feature/tree-sitter be merged (was Re: Tree-sitter and major mode inheritance) Jostein Kjønigsen
2022-11-18 22:34   ` Philip Kaludercic
2022-11-18 22:58     ` Yuan Fu
2022-11-18 23:36       ` Stefan Monnier
2022-11-19  7:09       ` Philip Kaludercic
2022-11-19 14:07         ` Standardized access to a REPL (was: Suggesting that feature/tree-sitter be merged) Stefan Monnier
2022-11-19 15:03           ` Standardized access to a REPL Philip Kaludercic
2022-11-19 16:07             ` Stefan Monnier
2022-11-19 16:10               ` Philip Kaludercic
2022-11-19 16:18                 ` Eli Zaretskii
2022-11-19 22:31                   ` Stefan Monnier
2022-11-20  9:25                     ` Philip Kaludercic
2022-11-19  8:29     ` Suggesting that feature/tree-sitter be merged (was Re: Tree-sitter and major mode inheritance) Eli Zaretskii
2022-11-19 10:46       ` Philip Kaludercic
2022-11-19 11:36         ` Eli Zaretskii
2022-11-19 12:15           ` Philip Kaludercic
2022-11-19 13:05             ` Eli Zaretskii
2022-11-19 21:34         ` Dmitry Gutov
2022-11-18 22:52   ` Yuan Fu
2022-11-19  5:21     ` Theodor Thornhill
2022-11-19 18:35       ` Eli Zaretskii
2022-11-19 18:46         ` Theodor Thornhill
2022-11-19 18:51           ` Eli Zaretskii
2022-11-19 18:59             ` Theodor Thornhill
2022-11-19  7:36     ` Stefan Kangas
2022-11-19  8:09       ` Eli Zaretskii
2022-11-19 11:25         ` Stefan Kangas
2022-11-19 11:49           ` Theodor Thornhill
2022-11-19 12:03           ` Eli Zaretskii
2022-11-19  8:16   ` Eli Zaretskii
2022-11-19  9:41 ` Tree-sitter and major mode inheritance Yuan Fu
2022-11-19 10:26   ` Eli Zaretskii
2022-11-19 10:29     ` Po Lu
2022-11-19 15:19     ` Stefan Monnier
2022-11-19 17:17       ` Yuan Fu
2022-11-19 17:52         ` Eli Zaretskii
2022-11-19 21:45           ` Yuan Fu
2022-11-20  7:05             ` Eli Zaretskii [this message]
2022-11-20  0:38       ` Po Lu
2022-11-19 21:39     ` Dmitry Gutov
2022-11-19 21:49       ` Yuan Fu
2022-11-19 22:03         ` Dmitry Gutov
2022-11-19 22:36           ` Dmitry Gutov
2022-11-19 23:36             ` Yuan Fu
2022-11-19 23:42               ` Dmitry Gutov
2022-11-20  7:28                 ` Eli Zaretskii
2022-11-20 13:22                   ` Dmitry Gutov
2022-11-20 14:49                     ` Eli Zaretskii
2022-11-20 15:24                       ` Dmitry Gutov
2022-11-20  7:11           ` Eli Zaretskii
2022-11-20  9:19             ` Yuan Fu
2022-11-20 10:02               ` Eli Zaretskii
2022-11-20 22:57                 ` Yuan Fu
2022-11-20  7:05         ` Eli Zaretskii
2022-11-20 17:12           ` Dmitry Gutov
2022-11-20 17:34             ` Eli Zaretskii
2022-11-20  6:51       ` Eli Zaretskii
2022-11-20 12:45         ` Dmitry Gutov
2022-11-20 14:42           ` 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=83bkp26r87.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=theo@thornhill.no \
    /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).