summaryrefslogtreecommitdiff
path: root/src/print.c
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-11-02 17:47:14 -0700
committerYuan Fu <casouri@gmail.com>2022-11-02 17:47:14 -0700
commit88d54756d46101b97b7fde97b4bc3b62f7bd6c06 (patch)
treee95a7a2af31576126a35c19662c1d79112c763b4 /src/print.c
parent32e87f09c8c2711c421363d0361693dcfbe5a688 (diff)
downloademacs-88d54756d46101b97b7fde97b4bc3b62f7bd6c06.tar.gz
emacs-88d54756d46101b97b7fde97b4bc3b62f7bd6c06.tar.bz2
emacs-88d54756d46101b97b7fde97b4bc3b62f7bd6c06.zip
Check for outdated tree-sitter node when printing
* src/print.c (print_vectorlike): Check for outdated node. * src/treesit.c (treesit_check_node): Use the new function. (treesit_node_uptodate_p): New function. * src/treesit.h: Declare new function.
Diffstat (limited to 'src/print.c')
-rw-r--r--src/print.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/print.c b/src/print.c
index a41ffa6cf04..1749d79299b 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2026,7 +2026,15 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
case PVEC_TS_NODE:
/* Prints #<treesit-node (identifier) in 12-15> or
#<treesit-node "keyword" in 28-31>. */
- print_c_string ("#<treesit-node ", printcharfun);
+ print_c_string ("#<treesit-node", printcharfun);
+ if (!treesit_node_uptodate_p (obj))
+ {
+ print_c_string ("-outdated>", printcharfun);
+ break;
+ }
+ printchar (' ', printcharfun);
+ /* Now the node must be up-to-date, and calling functions like
+ Ftreesit_node_start will not signal. */
bool named = treesit_named_node_p (XTS_NODE (obj)->node);
const char *delim1 = named ? "(" : "\"";
const char *delim2 = named ? ")" : "\"";