From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter and major mode inheritance Date: Sun, 20 Nov 2022 14:57:33 -0800 Message-ID: <0DA37668-14C5-408E-8687-CBC074FDE38A@gmail.com> References: <0249C656-21C8-49F2-B979-A1894BF80637@gmail.com> <1B76E73A-0DCD-456E-9F28-0E90723DA66D@gmail.com> <83sfif8cl2.fsf@gnu.org> <43E997E4-3449-4974-AB8C-BD5A4AA8A738@gmail.com> <837czq6qxr.fsf@gnu.org> <37649367-0BCD-4FD5-AC6D-8034883BC4FE@gmail.com> <83sfie54fj.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13370"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dgutov@yandex.ru, emacs-devel@gnu.org, monnier@iro.umontreal.ca, theo@thornhill.no To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 20 23:58:49 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 1owtGy-0003I3-TY for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Nov 2022 23:58:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owtFx-00035Y-0r; Sun, 20 Nov 2022 17:57:45 -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 1owtFt-000357-LA for emacs-devel@gnu.org; Sun, 20 Nov 2022 17:57:42 -0500 Original-Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1owtFr-0004vV-ME; Sun, 20 Nov 2022 17:57:40 -0500 Original-Received: by mail-pl1-x62d.google.com with SMTP id jn7so7188963plb.13; Sun, 20 Nov 2022 14:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GU/YKo3Y6kP813KBmyPMLZebcEiQykGuP2zx0q1RU0E=; b=gapO+l/WN/glxMnhYIiuOU4SbXNn0ySEKIrYgSYKFVkhi9JXiEFN6vUTF+Zb4LBMDx Qk7zXKxDLioRdBQZ+ISuHxEKtfNKlVlXN59ILH1r+tXM/dJUDV+R7tv1e71AkMefDci9 VRN7b1Tb14vryiCIettrNwYAXCUleIuYCbUT2ATB1Y3Rg783e5pPYpG2hIqvHDKxqYnW Hfro6j465zDOaLmgreYISCA2TCjZAj32A2jBtij47MkFlGoVk8yMHuDc9+XukYAoL/UQ Fxce6Lg+ptmjZv48wSVLO4838deGPOSCLdpZA9QyjunbK5vh7099Nto0CosNB9MNHKJP govA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GU/YKo3Y6kP813KBmyPMLZebcEiQykGuP2zx0q1RU0E=; b=brYYZv5QLx85wIzJLMW79QP7Ttg9G20Vn1DWigDMrQaqFhGx3rZomvCjIlmcMOqO9q 2jd072CCvQ91IXT3aZBqsKiS7h34pk7yDSSCY7+wRUcKJ8ISH+2yZOWlC7K+CtkE0pkO eFuSrJXaCOZMPjbUBiXXTYcUakmk5c75DVvs8selpOSlIk/tdJMqsC/UQ9i4GRgpi5H8 yiB3fbz1khAvVAqkGyU/MBbrXShpcHSOUocY6yOmC4+Rs/yVHfpmHWfU/jtvqWcADKbh tElM3LWUvE3KBIqvGtHkktKl7QylEfcIw8qiymdhxQ/L+dJXxSGx0YLNYb25Y+LBiOSy dW9Q== X-Gm-Message-State: ANoB5pnhxv95UvFtbKRS/OcW8VjgYz0WfcBMl6DHhkJhOpR+K7deUIUm f/KuedMQG8iblipxPBMzYsIi6QbsVpM= X-Google-Smtp-Source: AA0mqf4a/tF+SdefT/xBqjtKc88jA72kDj/imY3nEpThU44iqLk4CQdVRY1I239Di11blOFL4Bq8yQ== X-Received: by 2002:a17:903:2144:b0:188:5698:5beb with SMTP id s4-20020a170903214400b0018856985bebmr2786685ple.150.1668985057056; Sun, 20 Nov 2022 14:57:37 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id q4-20020a17090311c400b001865c298588sm8008646plh.258.2022.11.20.14.57.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Nov 2022 14:57:36 -0800 (PST) In-Reply-To: <83sfie54fj.fsf@gnu.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=casouri@gmail.com; helo=mail-pl1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:300276 Archived-At: > On Nov 20, 2022, at 2:02 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Sun, 20 Nov 2022 01:19:13 -0800 >> Cc: Dmitry Gutov , >> emacs-devel@gnu.org, >> monnier@iro.umontreal.ca, >> theo@thornhill.no >>=20 >>=20 >>=20 >>> On Nov 19, 2022, at 11:11 PM, Eli Zaretskii wrote: >>>=20 >>>> Date: Sun, 20 Nov 2022 00:03:35 +0200 >>>> Cc: Eli Zaretskii , emacs-devel@gnu.org, >>>> monnier@iro.umontreal.ca, theo@thornhill.no >>>> From: Dmitry Gutov >>>>=20 >>>> On 19.11.2022 23:49, Yuan Fu wrote: >>>>> Actually, that=E2=80=99s evidence supporting his preference: = js-mode will remain to be the native implementation, so inheriting from = it is exactly as before. Js-ts-mode will install tree-sitter stuff. And = js-base-mode wouldn=E2=80=99t do much. >>>>=20 >>>> But js-base-mode will be used in auto-mode-alist? >>>=20 >>> NO!!! auto-mode-alist should keep using js-mode, as it does today. >>>=20 >>> js-base-mode, if we need it, should just be a vehicle for easy = sharing of >>> common stuff between several modes that pertain to the same or = similar >>> languages. It should NOT be visible to users, so should not appear = in any >>> variables users are likely to customize. >>=20 >> Alright, changing js-mode to ja-native-mode is indeed a bad idea. So = this is what I did: for eg, js-mode, I created js-ts-mode and = js-base-mode. Js-mode and js-ts-mode inherits js-base-mode. = Auto-mode-alist has javascript-mode (that=E2=80=99s what=E2=80=99s in = the list right now, I didn=E2=80=99t change it). >>=20 >> If a user wants to use tree-sitter for javascript, they can add = (javascript-mode . js-ts-mode) into major-mode-remap-alist. >=20 > Or manually turn on js-ts-mode. Or customize auto-mode-alist to have > js-ts-mode be used in preference to js-mode. Right? Right. >=20 >> If someone wants js-mode and js-ts-mode to share the same = configuration, he needs to configure js-base-mode. So js-base-mode = isn=E2=80=99t completely invisible.=20 >=20 > We should not advertise js-base-mode. If people want to share > configurations between two modes, they should do that explicitly via = their > own hook function, or via copying the configurations. (And some of = the > configurations cannot be shared anyway, because the two modes use = different > features for font-lock and indentation.) Right. Yuan=