bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-no


From: Yuan Fu
Subject: bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer
Date: Thu, 28 Dec 2023 00:07:51 -0800


> On Dec 27, 2023, at 4:57 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Tue, 26 Dec 2023 20:15:24 -0800
>> Cc: Denis Zubarev <dvzubarev@yandex.ru>,
>> 67977@debbugs.gnu.org
>> 
>>> Btw, I hope that these calls to 'widen' don't require unnecessary
>>> reparsing by tree-sitter, do they?
>> 
>> Yes, but only because we called treesit-node-at while the buffer is 
>> narrowed, which triggers a reparse. Font-lock and jit-lock themselves always 
>> access the parser with widened buffer so they don’t trigger reparse on their 
>> own. 
>> 
>> So it seems working in a narrowed buffer would trigger a lot of 
>> back-and-fortch reparse. I wonder if it’s worth optimizing for (eg, use two 
>> parsers behind the scenes, one for widened buffer and one for narrowed 
>> buffer).
> 
> Could font-lock-dont-widen help, perhaps?

Yes. If font-lock doesn’t widen, then there wouldn’t be back-and-forth 
reparses. 

Yuan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]