aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorYuan Fu2024-07-26 22:33:17 -0700
committerYuan Fu2024-07-30 17:09:57 -0700
commite4cd26defc0e1a6deafbe4b2310ebdb3ffa4578f (patch)
treed57a2a02c1f7b2c08ecd146738e4c8f949793c94 /doc
parenta2c439db687774f7b57959c39560993579c5d1bd (diff)
downloademacs-e4cd26defc0e1a6deafbe4b2310ebdb3ffa4578f.tar.gz
emacs-e4cd26defc0e1a6deafbe4b2310ebdb3ffa4578f.zip
"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
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/parsing.texi11
1 files changed, 1 insertions, 10 deletions
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi
index 65549505b1e..a3d2a5ac71c 100644
--- a/doc/lispref/parsing.texi
+++ b/doc/lispref/parsing.texi
@@ -413,13 +413,6 @@ is non-@code{nil}, this function always creates a new parser.
413 413
414@var{tag} can be any symbol except @code{t}, and defaults to 414@var{tag} can be any symbol except @code{t}, and defaults to
415@code{nil}. Different parsers can have the same tag. 415@code{nil}. Different parsers can have the same tag.
416
417If that buffer is an indirect buffer, its base buffer is used instead.
418That is, indirect buffers use their base buffer's parsers. If the
419base buffer is narrowed, an indirect buffer might not be able to
420retrieve information of the portion of the buffer text that is
421invisible in the base buffer. Lisp programs should widen as necessary
422should they want to use a parser in an indirect buffer.
423@end defun 416@end defun
424 417
425Given a parser, we can query information about it. 418Given a parser, we can query information about it.
@@ -458,9 +451,7 @@ tree incrementally.
458@defun treesit-parser-list &optional buffer language tag 451@defun treesit-parser-list &optional buffer language tag
459This function returns the parser list of @var{buffer}, filtered by 452This function returns the parser list of @var{buffer}, filtered by
460@var{language} and @var{tag}. If @var{buffer} is @code{nil} or 453@var{language} and @var{tag}. If @var{buffer} is @code{nil} or
461omitted, it defaults to the current buffer. If that buffer is an 454omitted, it defaults to the current buffer.
462indirect buffer, its base buffer is used instead. That is, indirect
463buffers use their base buffer's parsers.
464 455
465If @var{language} is non-@var{nil}, only include parsers for that 456If @var{language} is non-@var{nil}, only include parsers for that
466language, and only include parsers with @var{tag}. @var{tag} defaults 457language, and only include parsers with @var{tag}. @var{tag} defaults