emacs-devel
[Top][All Lists]
Advanced

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

Re: Make all tree-sitter modes optional


From: Theodor Thornhill
Subject: Re: Make all tree-sitter modes optional
Date: Thu, 16 Feb 2023 08:53:56 +0100


On 16 February 2023 08:05:44 CET, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Wed, 15 Feb 2023 22:24:49 +0200
>> Cc: Alan Mackenzie <acm@muc.de>, Eli Zaretskii <eliz@gnu.org>,
>>  juri@linkov.net, casouri@gmail.com, larsi@gnus.org, theo@thornhill.no,
>>  jostein@secure.kjonigsen.net, emacs-devel@gnu.org
>> From: Dmitry Gutov <dgutov@yandex.ru>
>> 
>> On 15/02/2023 21:26, Stefan Monnier wrote:
>> > OTOH we can expose&preload `c-ts--activate` and tell users to use
>> > 
>> >      (cs-ts-activate)
>> 
>> A bunch of similar solutions have been proposed (global modes, etc; I 
>> can whip up one more in a few minutes as well), but they unfortunately 
>> failed to convince.
>
>Indeed, I'm still not convinced.  We should decide based on user
>reactions and requests once Emacs 29 is out.

To me the last point here is the important one. We kinda "rushed" the modes in 
so that the treesit backend would have anything to show for in emacs-29. We've 
tried many times to devise a mechanism for it to be unintrusive, and definitely 
so for the cc mode equivalents. Yes they are far behind them in some respects, 
so there was never a point to make them the default for the foreseeable future. 

Also remember that whatever mechanism we make now won't be part of Emacs 30+, 
as there are clear shortcomings in all directions. Let's rather focus on how we 
can improve the situation for Emacs 30.

I'm thinking some devise like a "language layer", where major and minor modes 
are pluggable.

Let's say you want to program in JavaScript.

Then you can for example do something like:

(make-language-layer 'js-layer
  :major-mode 'js-ts-mode
  :lsp 'eglot
  :dagnostics 'flymake)


Then

(add-to-list auto-mode-alist ".js" 'js-layer)

And so forth. In this case a person can swap out flymake for flycheck, eglot 
for lsp-mode, js-ts-mode for js-mode etc. Then no implementation "owns" the 
language namespace, and we hopefully don't step on anyone's toes.

What do you think?

Theo



reply via email to

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