diff options
| author | Yuan Fu | 2024-06-01 10:20:48 -0700 |
|---|---|---|
| committer | Yuan Fu | 2024-06-01 10:29:55 -0700 |
| commit | 20af58d3a13ddb5c2ca376da8cdd3fde4833ca2d (patch) | |
| tree | 34911232c2aa99244baef21db031ee6a8b326e30 /src/print.c | |
| parent | bf50aa38f9d2a3a5af8d32ce139c7533c912c476 (diff) | |
| download | emacs-20af58d3a13ddb5c2ca376da8cdd3fde4833ca2d.tar.gz emacs-20af58d3a13ddb5c2ca376da8cdd3fde4833ca2d.zip | |
Check for buffer liveness when accessing tree-sitter node (bug#71012)
* src/treesit.h (treesit_node_buffer_live_p): Declare function.
* src/print.c (print_vectorlike): Print node without position if
buffer is killed.
* src/treesit.c (treesit_node_buffer_live_p): New function.
(treesit_check_node): Add buffer liveness check.
(syms_of_treesit): New error treesit-node-buffer-killed.
Diffstat (limited to 'src/print.c')
| -rw-r--r-- | src/print.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/print.c b/src/print.c index d52d98ad371..8ee5a3616eb 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -2029,6 +2029,11 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, | |||
| 2029 | print_c_string ("-outdated>", printcharfun); | 2029 | print_c_string ("-outdated>", printcharfun); |
| 2030 | break; | 2030 | break; |
| 2031 | } | 2031 | } |
| 2032 | if (!treesit_node_buffer_live_p (obj)) | ||
| 2033 | { | ||
| 2034 | print_c_string ("-in-killed-buffer>", printcharfun); | ||
| 2035 | break; | ||
| 2036 | } | ||
| 2032 | printchar (' ', printcharfun); | 2037 | printchar (' ', printcharfun); |
| 2033 | /* Now the node must be up-to-date, and calling functions like | 2038 | /* Now the node must be up-to-date, and calling functions like |
| 2034 | Ftreesit_node_start will not signal. */ | 2039 | Ftreesit_node_start will not signal. */ |