GNU bug report logs - #67977
30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer

Previous Next

Package: emacs;

Reported by: Denis Zubarev <dvzubarev <at> yandex.ru>

Date: Fri, 22 Dec 2023 23:19:02 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 30.1

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: dvzubarev <at> yandex.ru, 67977 <at> debbugs.gnu.org
Subject: bug#67977: 30.0.50; tree-sitter: Emacs crashes when accessing treesit-nodes in a narrowed buffer
Date: Wed, 27 Dec 2023 14:57:09 +0200
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Tue, 26 Dec 2023 20:15:24 -0800
> Cc: Denis Zubarev <dvzubarev <at> yandex.ru>,
>  67977 <at> 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?




This bug report was last modified 1 year and 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.