Subject: Re: bug#64487: 29.0.92; Another tree-sitter warning inside Custom

From: Eli Zaretskii <[email-masked]>
Date: Thu, 06 Jul 2023 12:12:25 +0300

> Date: Thu, 06 Jul 2023 14:56:44 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> Type M-x customize RET.  Click Programming and then Languages.  A
> *Warnings* buffer will be displayed containing the following message:
> 
>   Warning (treesit): Cannot activate tree-sitter, because language
>   grammar for ruby is unavailable (not-found): (libtree-sitter-ruby
>   libtree-sitter-ruby.0 libtree-sitter-ruby.0.0 libtree-sitter-ruby.so
>   libtree-sitter-ruby.so.0 libtree-sitter-ruby.so.0.0) No such file or
>   directory

When you customize a group, Custom loads all the packages that belong
to the group.  So in this case it loads ruby-ts-mode, and you get the
warning.

> Can't these messages only be displayed when a tree-sitter major mode is
> enabled, as opposed to whenever the file implementing the major mode is
> loaded?

Emacs 29 deliberately checks for the grammar's availability when the
package is loaded, to give users a prominent indication that the
loaded package will not work.  This won't change in Emacs 29, but
maybe as part of rethinking this after releasing Emacs 29 we could
improve the situation with customizing a group as well.

Anyway, the warning is just a warning, and is otherwise harmless.  It
also only appears when Emacs has been built with tree-sitter, but the
grammar libraries required by some *-ts-mode's are not installed.