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

From: Morgan Willcock <[email-masked]>
Date: Mon, 26 Feb 2024 11:13:40 +0000

Eli Zaretskii <[email-masked]> writes:

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

I don't think this situation will be particularly rare for people who
choose to download the pre-built Windows binaries.

And I imagine that people choosing to acquire and run the program this
way (possibly because they do not know how to build the program
themselves) would probably be confused as to why the "out-of-the-box"
experience is generating warnings for features they are not actively
trying to use.

-- 
Morgan Willcock