summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-01-30 21:33:27 +0800
committerPo Lu <luangruo@yahoo.com>2023-01-30 21:33:40 +0800
commit176830fe2bb1c80ee128e515f6223cddc8b0a2ca (patch)
tree1fc24ddd49184a44761dd37fc03f73c01c2e8f60
parent3f069bd796b0024033640051b5f74ba9834985f8 (diff)
Fix incremental build failures with tree-sitter
* lisp/treesit.el (treesit-subtree-stat): Declare missing function. (treesit-buffer-root-node): Return nil if tree-sitter not present.
-rw-r--r--lisp/treesit.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/treesit.el b/lisp/treesit.el
index c9f2e339dc2..202a383ed7d 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -86,6 +86,7 @@
(declare-function treesit-search-subtree "treesit.c")
(declare-function treesit-search-forward "treesit.c")
+(declare-function treesit-subtree-stat "treesit.c")
(declare-function treesit-induce-sparse-tree "treesit.c")
(declare-function treesit-available-p "treesit.c")
@@ -265,12 +266,14 @@ If INCLUDE-NODE is non-nil, return NODE if it satisfies PRED."
Use the first parser in the parser list if LANGUAGE is omitted.
If LANGUAGE is non-nil, use the first parser for LANGUAGE in the
parser list, or create one if none exists."
- (if-let ((parser
- (if language
- (treesit-parser-create language)
- (or (car (treesit-parser-list))
- (signal 'treesit-no-parser (list (current-buffer)))))))
- (treesit-parser-root-node parser)))
+ ;; Otherwise the incremental build is broken without tree-sitter.
+ (when (treesit-available-p)
+ (if-let ((parser
+ (if language
+ (treesit-parser-create language)
+ (or (car (treesit-parser-list))
+ (signal 'treesit-no-parser (list (current-buffer)))))))
+ (treesit-parser-root-node parser))))
(defun treesit-filter-child (node pred &optional named)
"Return children of NODE that satisfies predicate PRED.