Subject: bug#60559: 29.0.60; "Cannot activate tree-sitter" spam

From: Eli Zaretskii <[email-masked]>
Date: Thu, 05 Jan 2023 08:51:44 +0200

> Cc: [email-masked], [email-masked]
> Date: Wed, 04 Jan 2023 22:03:12 +0200
> From: Eli Zaretskii <[email-masked]>
> 
> > From: Daniel Martín <[email-masked]>
> > Cc: Eric Gillespie <[email-masked]>,  [email-masked]
> > Date: Wed, 04 Jan 2023 20:40:24 +0100
> > 
> > Eli Zaretskii <[email-masked]> writes:
> > 
> > >
> > > This is not a bug.  Emacs 29 comes with major modes for TOML files and
> > > for Dockerfiles, and those new major modes require that you build
> > > Emacs with the tree-sitter library (and install the corresponding
> > > parser grammar libraries).  If you don't want to do that, you can
> > > instead customize auto-mode-alist to make Emacs use Fundamental mode
> > > (or any other mode you like) for these two file types.
> > 
> > Isn't this another manifestation of what's being discussed in bug#60511?
> > I also think that treesit-ready-p should not emit a warning by default,
> > it's too noisy and confusing for people that don't know about
> > Tree-sitter and consequently use a build of Emacs 29 without Tree-sitter
> > enabled.
> 
> That is one use case.  The other, no less important one, is when the
> user thinks his/her Emacs is built with tree-sitter and has the
> relevant stuff installed, whereas the reality is different.  Silently
> doing nothing in that case is hardly TRT.
> 
> So if we want to solve this, we need to find a solution that fits both
> of these use cases.

So here's a suggestion for such a solution: we make all the
*-ts-mode's optional.  That is, we don't add any of them to
auto-mode-alist unless the file *-ts-mode.el is loaded, and we
document them all in NEWS and the user manual as optional.  users who
want them will have to manually activate them.  This way, the original
use case that started this bug report is automatically solved, and the
other use case, where the user intends to activate one of these modes,
is also served by showing the warning, which in that case is perfectly
justified: the user asked for something that we cannot do, so we warn
him/her.

This is a retreat of sorts, but I think it strikes a better balance
wrt user expectations, assuming not everyone will build with
tree-sitter.

Any comments or objections?  If not, I will do this in a couple of
days on the emacs-29 branch.