aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/treesit.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/treesit.c b/src/treesit.c
index 45d1bc58b06..7393404f7ea 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -426,6 +426,7 @@ static Lisp_Object Vtreesit_str_space;
426static Lisp_Object Vtreesit_str_equal; 426static Lisp_Object Vtreesit_str_equal;
427static Lisp_Object Vtreesit_str_match; 427static Lisp_Object Vtreesit_str_match;
428static Lisp_Object Vtreesit_str_pred; 428static Lisp_Object Vtreesit_str_pred;
429static Lisp_Object Vtreesit_str_empty;
429 430
430/* This is the limit on recursion levels for some tree-sitter 431/* This is the limit on recursion levels for some tree-sitter
431 functions. Remember to update docstrings when changing this value. 432 functions. Remember to update docstrings when changing this value.
@@ -2042,8 +2043,9 @@ If NODE is nil, return nil. */)
2042 treesit_initialize (); 2043 treesit_initialize ();
2043 2044
2044 TSNode treesit_node = XTS_NODE (node)->node; 2045 TSNode treesit_node = XTS_NODE (node)->node;
2046 /* ts_node_type could return NULL, see source code. */
2045 const char *type = ts_node_type (treesit_node); 2047 const char *type = ts_node_type (treesit_node);
2046 return build_string (type); 2048 return type == NULL ? Vtreesit_str_empty : build_string (type);
2047} 2049}
2048 2050
2049DEFUN ("treesit-node-start", 2051DEFUN ("treesit-node-start",
@@ -4334,6 +4336,8 @@ the symbol of that THING. For example, (or sexp sentence). */);
4334 Vtreesit_str_match = build_pure_c_string ("match"); 4336 Vtreesit_str_match = build_pure_c_string ("match");
4335 staticpro (&Vtreesit_str_pred); 4337 staticpro (&Vtreesit_str_pred);
4336 Vtreesit_str_pred = build_pure_c_string ("pred"); 4338 Vtreesit_str_pred = build_pure_c_string ("pred");
4339 staticpro (&Vtreesit_str_empty);
4340 Vtreesit_str_empty = build_pure_c_string ("");
4337 4341
4338 defsubr (&Streesit_language_available_p); 4342 defsubr (&Streesit_language_available_p);
4339 defsubr (&Streesit_library_abi_version); 4343 defsubr (&Streesit_library_abi_version);