From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter and major mode inheritance Date: Sun, 20 Nov 2022 00:36:12 +0200 Message-ID: <2ccc9409-36ae-9bb5-127f-bb77a8b59460@yandex.ru> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24031"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Cc: Eli Zaretskii , emacs-devel@gnu.org, monnier@iro.umontreal.ca, theo@thornhill.no To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 19 23:36:54 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 1owWSE-00067h-6A for ged-emacs-devel@m.gmane-mx.org; Sat, 19 Nov 2022 23:36:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owWRw-0002WS-Oq; Sat, 19 Nov 2022 17:36:36 -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 1owWRv-0002WK-LY for emacs-devel@gnu.org; Sat, 19 Nov 2022 17:36:35 -0500 Original-Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1owWRt-0006Cq-IK; Sat, 19 Nov 2022 17:36:35 -0500 Original-Received: by mail-wr1-x429.google.com with SMTP id x17so1159172wrn.6; Sat, 19 Nov 2022 14:36:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=qv0vdg0Hzk6UNs2AriZFU3sI+gYZgj8qEtoxMdqkrQc=; b=WOG7LIZsTNgXk3JVKSyByK3949X+H5678/xraNeOVDhlsJVWPdW3h5m9rFN2yhf8Df zXhe1O/g8MAf7yMOo6JUlWupRa9STwcMXYhBgMF9wMT0JaUnnwq/XwvS6WUtCZWPlwRi 9W61TFvoQ/4+XiEqbLXmIA7BbFrXvDgnywI2u/5HQeUQwKZ1U7EPpJwh7JnJTPWPCnsS lIJs1NH1nB49TPLtO9i6HKRMLE9pWa/OmNxgGnI+HmwfdUix7Mr3Fs5eg2rcaXEj1WCu Mh9CHbh0Em7M4tr6d7nSmrVq1OHXmlSKK4D/PKWM7an6yvnCNY/I1GDnRfFbc2KDnUp4 5oZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qv0vdg0Hzk6UNs2AriZFU3sI+gYZgj8qEtoxMdqkrQc=; b=lduuMmFSzV70U43Kim6xsPpKRxKVDXu2g497i3HiADm7S839b0DcZRG84shoc4N09Q c/q2DU5FYao+0ovuzXlcYMY2jFGvso7ZAA355UbmLyPggCxp23K+eDJgRdj/nRTbtMfK m1NgafGYjP5ENmlLRqEgU2AhbM+ATjkRgbWR88Ve39GokJw5kHOGc3p2kI30sjzJ3VKQ nPm+leqH2Rtbl2SbIhTpdoNwhr7NKY85Livt8ImTCeJPvFuusBfKZiI/jLBncUlIGEwL IHZCJa0GKokT6pxoPmTxGAEBAhZxFuer41I46N2z2yXywcvdMa8EtyEhDsQQ2RJUvKth 3PqQ== X-Gm-Message-State: ANoB5pk6C1FeXdctoqXOGjZKtoRK+Z1qnvL5G16tOfjUYsFyKZykJCoE +lCWhctKM3hPfUmugnZWKHM= X-Google-Smtp-Source: AA0mqf7RHpeWzxXQxQfiCPjdg/TGVeEpZOrrbt4tEcfWXJGZWecK7QOqTh9taL2PTgaWCZOCeJ9XuA== X-Received: by 2002:adf:ee4d:0:b0:236:8ead:3da5 with SMTP id w13-20020adfee4d000000b002368ead3da5mr7568042wro.391.1668897375348; Sat, 19 Nov 2022 14:36:15 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id e16-20020adffd10000000b00241b933f8cesm7279577wrr.74.2022.11.19.14.36.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Nov 2022 14:36:15 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=raaahh@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:300212 Archived-At: On 20.11.2022 00:03, Dmitry Gutov wrote: > On 19.11.2022 23:49, Yuan Fu wrote: >> Actually, that’s 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’t do much. > > But js-base-mode will be used in auto-mode-alist? > > That should work, I think. Could we make the dispatcher "modes" regular functions, though? Keeping them out of the inheritance chain. 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? 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.