emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tree-sitter and major mode inheritance


From: Yuan Fu
Subject: Re: Tree-sitter and major mode inheritance
Date: Sat, 19 Nov 2022 15:36:51 -0800


> On Nov 19, 2022, at 2:36 PM, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> 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.

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?

Yuan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]