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: Dmitry Gutov
Subject: Re: Tree-sitter and major mode inheritance
Date: Sun, 20 Nov 2022 00:36:12 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2

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.



reply via email to

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