Don't signal an error in treesit-node-at

* lisp/treesit.el (treesit-node-at): Wrap
treesit-buffer-root-node within condition-case.
This commit is contained in:
Yuan Fu 2025-01-20 20:36:41 -08:00
parent 5d021a711a
commit a9cde2463a
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -213,9 +213,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)))