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

From: Gregory Heytings <[email-masked]>
Date: Thu, 05 Jan 2023 08:44:30 +0000

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

I suggest a slightly different solution: add a global minor mode, say 
'ts-modes'.  Users would only have to add (ts-modes 1) in their init 
files, and the logic would be:

(treesit-available-p) ts-modes
nil                   nil      => do nothing
nil                   t        => warning
t                     nil      => use available tree-sitter modes
t                     t        => use available tree-sitter modes

This seems more future-proof: otherwise users who want to user the 
available tree-sitter modes would have to require all such modes.  ATM 
there are only 19, but Emacs 30 could very well have twice or thrice that 
number of tree-sitter modes.