From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter and major mode inheritance Date: Sun, 20 Nov 2022 09:05:12 +0200 Message-ID: <83bkp26r87.fsf@gnu.org> References: <0249C656-21C8-49F2-B979-A1894BF80637@gmail.com> <1B76E73A-0DCD-456E-9F28-0E90723DA66D@gmail.com> <83sfif8cl2.fsf@gnu.org> <386C85F3-C183-4C00-B19B-8D4E1B254E89@gmail.com> <831qpy96ha.fsf@gnu.org> <1FE7635A-F90F-4198-AC97-922BA312C305@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40800"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org, theo@thornhill.no To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 20 08:05:57 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oweOr-000ANI-4o for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Nov 2022 08:05:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oweOG-00035c-I2; Sun, 20 Nov 2022 02:05:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oweO5-00035C-EG for emacs-devel@gnu.org; Sun, 20 Nov 2022 02:05:13 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oweO3-0003Ro-EF; Sun, 20 Nov 2022 02:05:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=h/UBphkDYni3Py6yvv2MrDcLNbeCdR0lVM+rynYMNPM=; b=C4UOnxmLh3hyxAMYTxov C5eLCPGkLpSUKjTG1s+kZYxr6yNNdz3rOjcE4kTQ9/0Bxsz0Nc0/XNBGXuAadp5T1WKYpdRbQOgqP 9F+UFz7TFUbA/qlx+AlqjZ23R2bd4fiQgUfpXimWRzxPTGVpPvEsgE6Ejxf3xYtmPb7pz89YQgcxw mWQaM+uzkm5kjwOabo7/7RiAvme6GxL0Q/Vl2W+TusCZpLzjSuaF4d9dIyh+ZoC5CposSM/S0WFiZ upgG9qTcR8XXODcjFv+Msm6oHMOSLRYpIXGw6sFDBdAB0i3UtcG9L1omIQdfSpdEuC4MyaI+wuV9H OQiBs9+8QXFBrQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oweO0-0002WH-2c; Sun, 20 Nov 2022 02:05:05 -0500 In-Reply-To: <1FE7635A-F90F-4198-AC97-922BA312C305@gmail.com> (message from Yuan Fu on Sat, 19 Nov 2022 13:45:41 -0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300228 Archived-At: > From: Yuan Fu > 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 wrote: > > > >> From: Yuan Fu > >> Date: Sat, 19 Nov 2022 09:17:11 -0800 > >> Cc: Eli Zaretskii , > >> emacs-devel@gnu.org, > >> theo@thornhill.no > >> > >> If we are already renaming existing modes (cc--mode), why don’t we use the generic name -mode for the virtual parent mode? It would be nicer if the generic mode (-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?