From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter and major mode inheritance Date: Sun, 20 Nov 2022 09:28:09 +0200 Message-ID: <8335ae6q5y.fsf@gnu.org> 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> <6D0D24A7-7A7B-4D8E-A267-1FA752071C68@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21830"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, 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 08:28:30 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 1owekg-0005WH-OU for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Nov 2022 08:28:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owekK-0003CD-Hx; Sun, 20 Nov 2022 02:28:08 -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 1owekG-0003Bx-UC for emacs-devel@gnu.org; Sun, 20 Nov 2022 02:28:07 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1owekE-0008Tq-T0; Sun, 20 Nov 2022 02:28:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=uy2u2kx/0trkIRMMiMpUR09kt2S+Zw1RV65TZED6bc8=; b=lA4ltjcfk1OV3i/IghDN ODJV0+TgvDTEomCS3yGBhAHwA9uAq5N66eKaWs91TitnqrnAL8gf8zDECkOaYGbZygcheox4Ih8Ry I7rQOW2KsFzQKtD6IwxZIruB+yGc0aY0BYrBjZCMa6xo2PXWtxtjdAynia+RDFAFqdOeuCIRrPvna qqXcaCa0e45PstCg+GawnPXqcSLRryGQOD2T1G4rhMGtBy8oT8ek0ZeEaoqcgLkg0bIsQHSKEPwHu DavUmFf9PX7ccLH3dvjoKUiqNs7LESP+MbVNT7Y8pYCKPQpDkrtSDquKbUsSFMK1qhXwAKfUEDWzZ D/Fi8c8jwEUusA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1owekC-0006cp-7I; Sun, 20 Nov 2022 02:28:02 -0500 In-Reply-To: (message from Dmitry Gutov on Sun, 20 Nov 2022 01:42:04 +0200) 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:300232 Archived-At: > Date: Sun, 20 Nov 2022 01:42:04 +0200 > Cc: Eli Zaretskii , emacs-devel@gnu.org, > monnier@iro.umontreal.ca, theo@thornhill.no > From: Dmitry Gutov > > On 20.11.2022 01:36, Yuan Fu wrote: > > If we keep js-mode as-is, and add js-base-mode and js-ts-mode, (derived-mode-p ‘js-mode) should keep working as before, or maybe I’m msiunderstanding your question? > > (derived-mode-p 'js-mode) will return nil in js-ts-mode. > > Which could be a problem when this call is used as a substitute for a > file type check (e.g. "are we editing a JavaScript file?"), which is one > of its common uses. This test can only work on the assumption that there's a single parent mode for all the modes which support a given programming language. This is a fragile assumption, so code which is based on it is broken and should be fixed. IOW, I don't think we should feel ourselves bound by this fragile assumption (assuming the solution we decide on breaks it).