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

From: Roi Martin <[email-masked]>
Date: Tue, 09 Sep 2025 10:24:49 +0200

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