Subject: Re: bug#60223: 29.0.60; Improve how tree-sitter changes to treesit--font-lock-fast-mode

From: Yuan Fu <[email-masked]>
Date: Sat, 24 Dec 2022 01:33:01 -0800

ronisbr <[email-masked]> writes:

> Hi Yuan!
>
> Em 2022-12-21 01:17, Yuan Fu escreveu:
>> Thanks for the report!
>> The "fast mode" should be buffer-local, so that particular file
>> shouldn’t affect other buffers. Just to make sure, you said that if you
>> open print.jl first, all other files are affected?
>
> Sorry for the misunderstanding. Indeed, only print.jl is affected.
>
> The behavior is:
>
>     1. If I open `print.jl` as the first file, the fast mode is
>     activated,
>        and the buffer shows a very strange font lock. All other buffers
>        (including Julia files) work as expected.
>     2. If I open any other Julia file and then I open `print.jl`, the
>     fast
>        mode is not activated, and everything works as expected.

Cool, that makes much more sence.

>> And I agree that the 0.01 second criterion is a crude one, but a long
>> string shouldn’t affect the _query_ time, and that string is not
>> long at
>> all, far from enough to make tree-sitter query to slow down. Let me
>> investigate and see what’s the real cause, and if this can be solved by
>> better solutions than making the threshold customizable. We can’t
>> expect
>> everyone to be able to pinpoint the culprit like you did :-)
>> Yuan
>
> Thanks! Let me know if I can help debugging :)

Which julia parser are you using? I installed the "official" one at
here: https://github.com/tree-sitter/tree-sitter-julia

but some queries in julia-ts-mode.el are not accepted by it, like the
(true) pattern: the parser I downloaded wants "true" instead.

Also julia-ts-mode has this code

(set-electric! 'julia-ts-mode
    :words '("catch"
             "else"
             "elseif"
             "finally"
             "end"))

which seems like a doom macro or something, since I don’t have doom
Emacs complains about undefined function. I commented it out so no
biggy, just FYI.

Yuan