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 01:19:13 -0800 Message-ID: <37649367-0BCD-4FD5-AC6D-8034883BC4FE@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> 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="8810"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov , 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 10:20:14 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 1owgUn-00026l-P8 for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Nov 2022 10:20:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owgU1-0007TG-JN; Sun, 20 Nov 2022 04:19:25 -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 1owgTz-0007Sn-Mi for emacs-devel@gnu.org; Sun, 20 Nov 2022 04:19:23 -0500 Original-Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1owgTx-0000hF-6u; Sun, 20 Nov 2022 04:19:22 -0500 Original-Received: by mail-pl1-x62e.google.com with SMTP id w23so8100371ply.12; Sun, 20 Nov 2022 01:19:19 -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=ZXr5Pvg/ThkHhBZafKDpYit/Thw6s0px5ouu8ULEVqM=; b=EV4R5Vce6sZ/Vds6bWVYiZ/VnZXwyuuLrpaqtUR0r3a5jdDqu1Izjx99ZLHawcPd8R PqQjYWWZ+Wz3IULz55Y6D9cplK5IYWX+8lX5E1efNIg1sPz+GHha10WLQ/0EAeRMtYrH xCiIWyuOwuidBUidxGhUiUg09QDg1U5uUS7+dZvvKZvisiIJinaap30X9n3Eyt/7fvuV XlR71Qu5lNxR+XK5UbYTYAlGxKiaHSZtEGwo//gB6OqvcPOO473gDeYS+tHVrmHB8fTS bLmZrj1I4catmebTJIVNuhc+cIUGK2FOYU8bXUO/mJC/PiL9rA/nIOD7KPOVQYtpdLmA dJCA== 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=ZXr5Pvg/ThkHhBZafKDpYit/Thw6s0px5ouu8ULEVqM=; b=YqxzQLAFGKTU+KcGmSBovhvS2gxRdWfovPN9YBn6vVxrkuQhMZUF1EYKCIeRm8SO70 QSDN0VNTd8zvLdZxQG/gHy/Jeg1hkJkf6cQzZggg2z9WA83GcCTNyXtuZ8vy+CTpdZuZ yKr88bAIFGpNq32s09smSDK1S80XrhaCID87064EzjBpoAx+eIvFzuhB1gB++I9Skps1 KMcAfSfTpXE1n6BXq5l6EjjqQ5ufgXHFOfW2rTL4gMduMIORUM2yOIQ5VPVHw8+Kf0pN 7sLDgtN+FS4outyq/9qMrY+b2ilY+zeAhzCePJVNsR4+XizVBjTi/3N4tQCKapyBy5h6 /wyw== X-Gm-Message-State: ANoB5plezOjfycnrwke5OoykMLe+iGoM3TiYnxfkirsA4QUIaZxfI9wn eG8W0aZyRGL8035n+DH+T/SyI6VlhMg= X-Google-Smtp-Source: AA0mqf4NJlWYS0cpqEe5JIXtj05F0pgDjNQk/s2sAn18wsrhyNMYhjVjhNOp/p8OVwlkkny2/Gf+jQ== X-Received: by 2002:a17:903:44f:b0:187:3a43:3a9d with SMTP id iw15-20020a170903044f00b001873a433a9dmr6771427plb.152.1668935958205; Sun, 20 Nov 2022 01:19:18 -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 mm9-20020a17090b358900b00212c27abcaesm8320233pjb.17.2022.11.20.01.19.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Nov 2022 01:19:17 -0800 (PST) In-Reply-To: <837czq6qxr.fsf@gnu.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=casouri@gmail.com; helo=mail-pl1-x62e.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:300235 Archived-At: > 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. 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). If a user wants to use tree-sitter for javascript, they can add = (javascript-mode . js-ts-mode) into major-mode-remap-alist. 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 Yuan=