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: Eli Zaretskii
Subject: Re: Make all tree-sitter modes optional
Date: Thu, 16 Feb 2023 19:05:29 +0200

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: dgutov@yandex.ru,  acm@muc.de,  juri@linkov.net,  casouri@gmail.com,
>   larsi@gnus.org,  theo@thornhill.no,  jostein@secure.kjonigsen.net,
>   emacs-devel@gnu.org
> Date: Thu, 16 Feb 2023 11:45:30 -0500
> 
> >> 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.

> >> 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.)

> > 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.

> E.g. if users do as (require 'c-ts-mode) as you suggest, they'll bump
> into a regression when they move on to Emacs-30 where we will have
> hopefully fixed this misfeature.

If Emacs 30 will require different ways of activating these modes, we
will document that in NEWS.  Right now, the chances for such a change
are very high anyhow, so I already took this into account.

> 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.

> The current code will bring bad surprises to some of our users when they
> try Emacs-29, and it will bring further bad surprises later when we move
> to a different solution.

I understand and agree it could happen, but again: I see no better
way.  Every alternative that was proposed, including those proposed
now, had its own disadvantages, and I think what we have now is the
least of all evils.

> The fix is trivial enough that the urgency doesn't pose any problem.

The fix is not trivial at all.  If it were, we would have found it
already, as we are debating this for the past two or three months, and
it's not like we lack people here who can come up with bright ideas.



reply via email to

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