|
From: | Dmitry Gutov |
Subject: | Re: Tree-sitter and major mode inheritance |
Date: | Sun, 20 Nov 2022 15:22:40 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 |
On 20.11.2022 09:28, Eli Zaretskii wrote:
Date: Sun, 20 Nov 2022 01:42:04 +0200 Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org, monnier@iro.umontreal.ca, theo@thornhill.no From: Dmitry Gutov <dgutov@yandex.ru> 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.
Technically correct, the best kind of correct.
This is a fragile assumption, so code which is based on it is broken and should be fixed.
Okay then, but then we'll need to learn another way to ask that question. Previously, we did try to ensure (not always successfully) a single inheritance chain between such modes.
[Prev in Thread] | Current Thread | [Next in Thread] |