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: Sat, 19 Nov 2022 13:49:50 -0800 Message-ID: <43E997E4-3449-4974-AB8C-BD5A4AA8A738@gmail.com> References: <0249C656-21C8-49F2-B979-A1894BF80637@gmail.com> <1B76E73A-0DCD-456E-9F28-0E90723DA66D@gmail.com> <83sfif8cl2.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="7354"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org, monnier@iro.umontreal.ca, theo@thornhill.no To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 19 22:50:25 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 1owVjF-0001j2-Fi for ged-emacs-devel@m.gmane-mx.org; Sat, 19 Nov 2022 22:50:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owViq-0008JS-6Y; Sat, 19 Nov 2022 16:50:00 -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 1owVin-0008J4-U3 for emacs-devel@gnu.org; Sat, 19 Nov 2022 16:49:57 -0500 Original-Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1owVim-00026t-DC; Sat, 19 Nov 2022 16:49:57 -0500 Original-Received: by mail-pf1-x434.google.com with SMTP id d192so8119878pfd.0; Sat, 19 Nov 2022 13:49:53 -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=OiY0QnZ7H4P/sDHRKEJLjdmj2IWKhtP4CD7OdQvnB7c=; b=Cjb366ZGLzP3mdviem5PiNTO5D++Kl44poOxuhGTU+b+JEUgnBdAG4F1NZffViI7kA 95QL74TlESB5eWUY/JvUNvPf8WU+7dVaolkI96PYSZP64j4nstMArfQlw0XKKF/JHnm4 RQhrTeVZWNHzSeLxavEb50i21h1MmOceIRclVK8Xqm2HIhrqpJH7easETShLd50kiOkb 4FoidcjQ3GIXy/3A325iFwg68croecVxiWD4Ni9n7LgPEWGKl5/m69AjsKq80kyxYZkK HZGjPugn5uJAr9CTOMLcNTvFDRnKp9aVvbd7jk514W7jrH/rlpX0UjzXqlMjHV4XAfC4 IXCw== 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=OiY0QnZ7H4P/sDHRKEJLjdmj2IWKhtP4CD7OdQvnB7c=; b=RC1FHNaZHILynC2wKIBHCCRoCgX7d1Wk7Dz+1VqQhkdAJN1PY0h7cZjC0oqiRmT1vP 6WLNBQ+YwOIgziWky5iHD1wtuJ0Y+f4rhdUeJ7J5U82ssyzBt37MRZDhQFMs2oD103yV j5ROrlL7IpvHLuxsgjZSNg5Pr7UkeLf0QiYsYZUNNGiV+lUfK1Zx8aP2YHsyKFIy4H1U 6mFL/15bquA8uJLO3kPr+4HC6PzGux2RbAcAXS3tVcl6osBRDM3OaktcRy67zc4LsErO zctDvbnrWqVISRtXBRYqtC8KppchplnXUMyjuJqUwr8I9RRxUZJHwPRtmqrbzDkDMVoA JhBw== X-Gm-Message-State: ANoB5pldojMZW5sI6Oo3Nb+1cI0ADY2pz0jtiUMWALpYxr/mihOFbUhz +pnkVplsvPCqYcLya7Y0ev0t2Lb/S9c= X-Google-Smtp-Source: AA0mqf6MKAPqXSgfA6kj9mLeRwTQ97yMr0CfzCEhRU7OHx3LSHpn7ELJXvzCDKrBHgQEGbMupbTiPg== X-Received: by 2002:a63:4b1d:0:b0:476:837c:e0a with SMTP id y29-20020a634b1d000000b00476837c0e0amr12052625pga.411.1668894592078; Sat, 19 Nov 2022 13:49:52 -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 g1-20020aa79dc1000000b0056befcd7958sm5568720pfq.84.2022.11.19.13.49.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Nov 2022 13:49:51 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=casouri@gmail.com; helo=mail-pf1-x434.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:300209 Archived-At: > On Nov 19, 2022, at 1:39 PM, Dmitry Gutov wrote: >=20 > On 19.11.2022 12:26, Eli Zaretskii wrote: >>> From: Yuan Fu >>> Date: Sat, 19 Nov 2022 01:41:47 -0800 >>> Cc: Stefan Monnier, >>> Eli Zaretskii, >>> Theodor Thornhill >>>=20 >>> Anyway, does anyone think this is a good/bad idea? Should I go = implement this on css, js, c, etc? It can also be the other way around: = instead of having c-mode being the virtual mode, we can leave c-mode = as-is, and have a c-base-mode inherited by c-mode and c-ts-mode. And = similarly rss-base-mode, rss-mode, and rss-ts-mode. >> I'd prefer leaving the original modes as-is. That should cause less >> compatibility problems, I think. >=20 > Eli, what's your solution for the problem, then? >=20 > E.g. js-mode enables tree-sitter, and installs some stuff based on it. >=20 > But js2-mode inherits from js-mode (meaning, it will run the same = setup code, and then some of its own), yet it has its own parser. Which = will cause all sorts of conflicts with tree-sitter. 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. Yuan=