From 7dbcc7556c22aa3305cb6c6e96ac2a5c7a40f4d3 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Mon, 20 Jan 2025 20:36:41 -0800 Subject: [PATCH] Don't signal an error in treesit-node-at * lisp/treesit.el (treesit-node-at): Wrap treesit-buffer-root-node within condition-case. (cherry picked from commit a9cde2463abd6677e9d44d306473beef00983aad) --- lisp/treesit.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 4cca074c304..079187e3a54 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -232,9 +232,11 @@ language and doesn't match the language of the local parser." (car (treesit-local-parsers-at pos parser-or-lang)))) (treesit-parser-root-node parser)) - (treesit-buffer-root-node - (or parser-or-lang - (treesit-language-at pos)))))) + (condition-case nil + (treesit-buffer-root-node + (or parser-or-lang + (treesit-language-at pos))) + (treesit-no-parser nil))))) (node root) (node-before root) (pos-1 (max (1- pos) (point-min))) -- 2.39.5