GNU bug report logs - #78402
treesit after-change-functions

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Tue, 13 May 2025 06:34:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 78402 <at> debbugs.gnu.org
Subject: bug#78402: treesit after-change-functions
Date: Fri, 06 Jun 2025 18:42:57 +0300
>> 1. M-: (setq outline-minor-mode-cycle t)
>> 2. M-: (setq outline-minor-mode-use-buttons t)
>> 3. M-: (setq debug-on-error t)
>> 4. C-x p f test/manual/indent/html-multi.html
>> 5. M-x load-library RET treesit-x
>> 6. M-x liquid-generic-ts-mode
>> 7. M-x outline-minor-mode
>> 8. move point to the first 's' in 'script' on line 19
>> 9. type 'M-d' ('kill-word')
>
> Aha, I reproduced it. It didn’t happen when I kill-word, but happened when
> I undo.

This is what I observe too: when it doesn't fail on edit,
then in any case it fails on undo.

> I’m still trying to understand why the node-outdated error can
> happen. Each parser has a tick, which is incremented whenever it
> re-parses. When we create a node from the parser, the node inherits the
> current tick number of the parser. We only consider a node outdated when
> its tick is less than its parser’s tick, meaning the parser re-parsed after
> the node is created. For a parser to re-parse, it has to a) receive
> a buffer edit or b) change it’s ranges; and then someone needs to request
> a node from it.
>
> That means in the following backtrace, the parser received a buffer
> edit or changed its ranges after the `prev` node is created. And
> that’s baffling to me.

Maybe calling this from after-change-functions affects the order of
calling parser functions.




This bug report was last modified 10 days ago.

Previous Next


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