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: Dmitry Gutov
Subject: Re: Make all tree-sitter modes optional
Date: Thu, 16 Feb 2023 21:14:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 16/02/2023 19:05, Eli Zaretskii wrote:
But with my patch, trying the modes is exactly the same (just `M-x
c-ts-mode`) and turning them on in their customization is no harder
(since `(c-ts-activate)` is no harder to type than `(require
'c-ts-mode)`
Sorry, I don't buy this argument.
Care to expand a bit more.
I don't agree that calling (c-ts-activate) in an init file is no
harder than loading a package.  For you and me, maybe, but not for
users.

Loading a package is easy. But what happens after the user decides they like the new major mode and want to use it in every session? They will need to add something to their init script. And at that point,

(require 'c-ts-mode)

is not particularly easier for a newbie than

(treesit-setup-mode 'c-ts-mode)

Or (treesit-setup-mode 'c), or (c-ts-activate), or whatever.

we could also make it a global minor mode so it can be
done via Custom if it's considered important).
This was considered already, but had its own issues.
Can you mention at least one?
Sorry, I remember only the conclusion.  You will have to look up the
discussions.  (And you were here when they happened.)

It has been my impression that you made up your mind pretty early on, so I didn't even try to get into the discussions for the technical solutions, but (*)

We'll have to make this one exception to the rule.  The situation
itself is exceptional and probably won't happen again soon, if ever.
I understand there's time pressure.  But I think this would argue
towards making the code more conservative (e.g. not change the defaults
at all, not even after enabling `c-ts-mode`) since that's much less
likely to bring problems now and in the future.
That'd make it significantly harder for users to try these modes, so I
cannot agree to that.

To try a major mode like that, the user can 'M-x c-ts-mode' either way, no matter the solution we choose.

I think if we want a quick&dirty short-term way to encourage the use of
tree-sitter by enthusiastic users, we should provide a "one stop shop"
function which redirects all applicable major modes to their tree-sitter
variant.
That, too, was suggested a couple of months ago.  It has a
disadvantage of blindly assuming that a given user will either want
all of the TS modes or none of them.  It also assumes that a given
user has all of the grammar libraries installed.  Both assumptions are
not necessarily true, and so I decided that we must allow the users to
make separate and independent decisions for each such case.

(*)

If you prefer the users enable the modes one-by-one, we can provide a helper to do just that. Like in the example above, it could be called 'treesit-setup-mode' and could accept as an argument either the major mode name, or a language, and set up the necessary auto-mode-alist or major-mode-alist-alist entries.



reply via email to

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