From: Yuan Fu Date: Tue, 21 Jan 2025 04:36:41 +0000 (-0800) Subject: Don't signal an error in treesit-node-at X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7dbcc7556c22aa3305cb6c6e96ac2a5c7a40f4d3;p=emacs.git 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) --- 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)))