]> git.eshelyaron.com Git - emacs.git/commit
"Separate" tree-sitter parser list for indirect buffers
authorYuan Fu <casouri@gmail.com>
Sat, 27 Jul 2024 05:33:17 +0000 (22:33 -0700)
committerEshel Yaron <me@eshelyaron.com>
Wed, 31 Jul 2024 14:33:08 +0000 (16:33 +0200)
commit0a5db866f225ce6f94c916e3fc9210f30f7f9a51
treeca6fe59d881f2f201c90f1d2b2d856c87fd939d7
parent19f21e9267a4631c6a35556cc1d82e0a038b9c60
"Separate" tree-sitter parser list for indirect buffers

When create a parser for the indirect buffer, set the buffer field of
the parser to the indirect buffer, but add the parser to the base
buffer's parser list.  This way, all the parsers still get buffer
updates, but indirect buffer's parsers can have different narrowing than
the parsers of the base buffer.

When returning the parser list of a buffer, do filtering and only return
the parser for that buffer.

From user's POV, indirect buffers appear to have their own parser list.

* doc/lispref/parsing.texi (Using Parser): Remove the text describing
indirect buffer's special case.
* src/treesit.c (Ftreesit_parser_create): When create a parser for the
indirect buffer, set the buffer field of the parser to the indirect
buffer, but add the parser to the base buffer's parser list.
(Ftreesit_parser_list): Filter parser list, only return parsers for this
buffer.

xx

(cherry picked from commit e4cd26defc0e1a6deafbe4b2310ebdb3ffa4578f)
doc/lispref/parsing.texi
etc/NEWS
src/treesit.c