Subject: Re: bug#79363: 31.0.50; Font locking issue in go-ts-mode when tree-sitter grammar is automatically installed

From: Yuan Fu <[email-masked]>
Date: Wed, 10 Sep 2025 00:19:50 -0700

> On Sep 10, 2025, at 12:09 AM, Yuan Fu <[email-masked]> wrote:
> 
> 
> 
>> On Sep 9, 2025, at 1:24 AM, Roi Martin <[email-masked]> wrote:
>> 
>> Yuan Fu <[email-masked]> writes:
>> 
>>> Thanks for the analysis! Does that mean once the grammar is installed,
>>> and you restart Emacs, go-ts-mode would work as normal?
>> 
>> Yes, that is correct.
>> 
>>> We do need to fix how we’re defining font-lock rules, the test should
>>> be done when major mode is enabled, not when the package is loaded. I
>>> thought about this problem and wanted to come up with some generic
>>> solution, such as letting treesit-font-lock-rules support a predicate
>>> function/query for font-lock-rules, or define rules in a fallback
>>> list. I didn’t come up with a very satisfying solution and the
>>> progress kind of stalled. Anyway, now it seems I need to put some
>>> thought into this and come up with something soon.
>> 
>> After discussing it with Juri, I've sent a few patches that fix some of
>> the affected tree-sitter modes.  You can read the conversation in the
>> issue:
>> 
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79363
>> 
>> However, I'm working on more patches, so you might want to check the
>> ones I've already sent.  Feedback is more than welcome.
>> 
>> Thanks!
>> 
>>       Roi
> 
> Apologies, apparently I didn’t get any of the messages between you and Juri. I’ve cursed at my mail client and will read the conversation on the archive :-)
> 
> Yuan

I read the thread and it looks good to me. Thanks for working on it!

Yuan