GNU bug report logs -
#59693
29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly
Previous Next
Reported by: miha <at> kamnitnik.top
Date: Tue, 29 Nov 2022 20:21:01 UTC
Severity: normal
Found in version 29.0.50
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
miha <at> kamnitnik.top writes:
> *** Welcome to IELM *** Type (describe-mode) or press C-h m for help.
> ELISP> (set-buffer (get-buffer-create "a"))
> ELISP> (insert "int main();")
> ELISP> (require 'treesit)
> ELISP> (treesit-node-children (treesit-node-child (treesit-buffer-root-node 'c) 0))
> (#<treesit-node
> (primitive_type)
> in 1-4> #<treesit-node
> (function_declarator)
> in 5-11> #<treesit-node ";" in 11-12>)
>
> This is expected
>
> ELISP> (set-buffer (make-indirect-buffer "a" "b"))
> ELISP> (goto-char (point-min))
> ELISP> (insert " ")
> ELISP> (set-buffer "a")
> ELISP> (buffer-string)
> " int main();"
>
> ELISP> (treesit-node-children (treesit-node-child (treesit-buffer-root-node 'c) 0))
> (#<treesit-node
> (primitive_type)
> in 1-4> #<treesit-node
> (function_declarator)
> in 5-11> #<treesit-node
> (ERROR)
> in 11-12> #<treesit-node ";" in 12-13>)
>
> This is unexpected. If we had called '(insert " ")' in the base buffer
> "a", we would have got
>
> (#<treesit-node
> (primitive_type)
> in 2-5> #<treesit-node
> (function_declarator)
> in 6-12> #<treesit-node ";" in 12-13>)
>
> Thanks for your hard work.
Thanks! I forgot about indirect buffers... We’ll need to make sure to
use the parsers in the original buffer when user edits the indirect
buffer, or something like that. I need to look into how does indirect
buffer works.
Yuan
This bug report was last modified 2 years and 163 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.