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 15:36:51 -0800 Message-ID: <6D0D24A7-7A7B-4D8E-A267-1FA752071C68@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> <2ccc9409-36ae-9bb5-127f-bb77a8b59460@yandex.ru> 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="23149"; 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 Sun Nov 20 00:37:58 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 1owXPK-0005sL-Gc for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Nov 2022 00:37:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owXOP-0000fY-Ah; Sat, 19 Nov 2022 18:37:01 -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 1owXOO-0000es-4Y for emacs-devel@gnu.org; Sat, 19 Nov 2022 18:37:00 -0500 Original-Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1owXOJ-0004lP-M0; Sat, 19 Nov 2022 18:36:57 -0500 Original-Received: by mail-pj1-x1031.google.com with SMTP id t17so6824170pjo.3; Sat, 19 Nov 2022 15:36:54 -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=lm3Rb59dKjAIEGVBxkcqBtjvGsd/5kzyAgM4YkrDnGM=; b=qQFq4vMfIJPpmRx2m9Xj/kXisqiQKDPwALo7DINgtbCClnB1AT06+V8h17p8AnWane YOf2QtchkcJvPaYFkFIRRF1tyhyN/6UJ0dw8IqZ+HdEeZJkgVdNMFNehR9I15kk6w28p 8AWiQSkXgasbo6qcukpF4mtDZZwwMtlljovyL97rfqJOYSH6eXo6mkMLl5Cs9dagBztq UxL7zIZwbtRCBDPj4CvsB/InEuIM5fwL9Smk8W2P/t9iLODP10Ol4NoSxwRlK6nREDcN fU0lW5E+vJ8tyEj7nw6ombMq6m8swgNps4BtZhWLcmoe15ZBE3uUbZXaEOa2Tuc4jYFy 1ywQ== 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=lm3Rb59dKjAIEGVBxkcqBtjvGsd/5kzyAgM4YkrDnGM=; b=P8NsIBopSEScCKQhy2kCqJzv6by0bL4KsTW3w8J2Y8LXtIuJ17a+K9R1F7wRFUxetw 7GPg76lTGYVvApn0UZJfDvbVHSzJBjaWEuaAdOwE1+4WFTO3ImiUh6OqzvEZZPpsZd/k gjM9bDQ0SvcwmD50iIdyLyufw8Gy7hkvFw0dZEAApcf76YaOwPbCi4XHhHPCRiG719Dt xUUkkAtor9LWrjBCcQpgxvINsDWBvWgcMC23Xta1fiEACGBCREM9t9qMFmXLQIxTMabC SoyNqSB+Ai0sJg3XVtY9MyyblSg6TAla27DmZuS5dcdbpcOMSObmYk0NUMty9JEuiknI mY0g== X-Gm-Message-State: ANoB5pnMshAaflpV69Fy2Rto4P8muKnpbuySWo9xoRlRgYxHffBKHLGV kTmB6crV/sFazvg1Mzlg6aI= X-Google-Smtp-Source: AA0mqf7cQftgsPC/qOv2CkgQkSwZrhU8aKptnFr3vaOsNJyIiNgEvZYZVvRaWjUyL/gNMSiS3KCS5Q== X-Received: by 2002:a17:902:bc84:b0:17f:700a:2cd3 with SMTP id bb4-20020a170902bc8400b0017f700a2cd3mr5798015plb.36.1668901013582; Sat, 19 Nov 2022 15:36:53 -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 n62-20020a622741000000b0056b88187374sm5598859pfn.85.2022.11.19.15.36.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Nov 2022 15:36:53 -0800 (PST) In-Reply-To: <2ccc9409-36ae-9bb5-127f-bb77a8b59460@yandex.ru> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=casouri@gmail.com; helo=mail-pj1-x1031.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:300216 Archived-At: > On Nov 19, 2022, at 2:36 PM, Dmitry Gutov wrote: >=20 > On 20.11.2022 00:03, Dmitry Gutov wrote: >> 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. >> But js-base-mode will be used in auto-mode-alist? >> That should work, I think. >=20 > Could we make the dispatcher "modes" regular functions, though? = Keeping them out of the inheritance chain. >=20 > That would make (derived-mode-p 'js-base-mode) always fail, of course, = but if we are talking about existing code, there will be checks like = (derived-mode-p 'js-mode) which are going to fail anyway now because = js-js-mode isn't going to derive from js-mode. Could this be solvable = through major-mode-remap-alist? >=20 > And if they (base modes) are not real modes, call it something like = js-mode-dispatch or js-mode-virtual. Or js-mode-choose, etc, something = with a verb at the end might do a better signal that it's not a "mode" = and there is no point in inheriting or doing derived-mode-p checks on = it. If we keep js-mode as-is, and add js-base-mode and js-ts-mode, = (derived-mode-p =E2=80=98js-mode) should keep working as before, or = maybe I=E2=80=99m msiunderstanding your question? Yuan=