[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/tree-sitter ccd2509ed3 7/8: Don't print buffer when printing tre
From: |
Yuan Fu |
Subject: |
feature/tree-sitter ccd2509ed3 7/8: Don't print buffer when printing tree-sitter node and parser |
Date: |
Tue, 1 Nov 2022 16:28:16 -0400 (EDT) |
branch: feature/tree-sitter
commit ccd2509ed31f953408240357e9b84c3d3b3f6a2b
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Don't print buffer when printing tree-sitter node and parser
Additionally, print node's position in buffer.
* doc/lispref/parsing.texi (Retrieving Node): Reflect this change in
manual.
* src/print.c (print_vectorlike): Remove printing of buffer, add
printing of node position.
---
doc/lispref/parsing.texi | 4 ++--
src/print.c | 9 +++++----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi
index 7164baaa6d..e280ac8c64 100644
--- a/doc/lispref/parsing.texi
+++ b/doc/lispref/parsing.texi
@@ -516,7 +516,7 @@ Example:
@group
;; Find the node at point in a C parser's syntax tree.
(treesit-node-at (point) 'c)
- @result{} #<treesit-node (primitive_type) in *scratch*>
+ @result{} #<treesit-node (primitive_type) in 23-27>
@end group
@end example
@end defun
@@ -617,7 +617,7 @@ This function finds the child of @var{node} whose field
name is
@group
;; Get the child that has "body" as its field name.
(treesit-child-by-field-name node "body")
- @result{} #<treesit-node (compound_statement) in *scratch*>
+ @result{} #<treesit-node (compound_statement) in 45-89>
@end group
@end example
@end defun
diff --git a/src/print.c b/src/print.c
index 0c50cbab09..a6cb0191c7 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2018,9 +2018,9 @@ print_vectorlike (Lisp_Object obj, Lisp_Object
printcharfun, bool escapeflag,
case PVEC_TS_PARSER:
print_c_string ("#<treesit-parser for ", printcharfun);
Lisp_Object language = XTS_PARSER (obj)->language_symbol;
+ /* No need to print the buffer because it's not that useful: we
+ usually know which buffer a parser belongs to. */
print_string (Fsymbol_name (language), printcharfun);
- print_c_string (" in ", printcharfun);
- print_object (XTS_PARSER (obj)->buffer, printcharfun, escapeflag);
printchar ('>', printcharfun);
break;
case PVEC_TS_NODE:
@@ -2034,8 +2034,9 @@ print_vectorlike (Lisp_Object obj, Lisp_Object
printcharfun, bool escapeflag,
print_string (Ftreesit_node_type (obj), printcharfun);
print_c_string (delim2, printcharfun);
print_c_string (" in ", printcharfun);
- print_object (XTS_PARSER (XTS_NODE (obj)->parser)->buffer,
- printcharfun, escapeflag);
+ print_object (Ftreesit_node_start (obj), printcharfun, escapeflag);
+ printchar ('-', printcharfun);
+ print_object (Ftreesit_node_end (obj), printcharfun, escapeflag);
printchar ('>', printcharfun);
break;
case PVEC_TS_COMPILED_QUERY:
- feature/tree-sitter updated (9fab83ed7a -> 50e33639fe), Yuan Fu, 2022/11/01
- feature/tree-sitter b49250ada9 2/8: Use treesit-fontify-with-override in tree-sitter functions, Yuan Fu, 2022/11/01
- feature/tree-sitter a3651d3237 4/8: Query on the root node in tree-sitter font-lock, Yuan Fu, 2022/11/01
- feature/tree-sitter 6d5b34d9de 6/8: ; Tree-sitter font-lock debugging: print node type not language, Yuan Fu, 2022/11/01
- feature/tree-sitter ccd2509ed3 7/8: Don't print buffer when printing tree-sitter node and parser,
Yuan Fu <=
- feature/tree-sitter f6e92035a7 5/8: Allow user to add/remove tree-sitter font-lock features, Yuan Fu, 2022/11/01
- feature/tree-sitter eeeae5e9ee 1/8: Add an argument OVERRIDE to tree-sitter font-lock functions, Yuan Fu, 2022/11/01
- feature/tree-sitter 50e33639fe 8/8: Fix string fontification for tree-sitter python-mode, Yuan Fu, 2022/11/01
- feature/tree-sitter 4ef50ccd3f 3/8: ; Explain the BEG and END argument in treesit-query-capture better, Yuan Fu, 2022/11/01