diff options
| author | Po Lu | 2023-01-30 21:33:27 +0800 |
|---|---|---|
| committer | Po Lu | 2023-01-30 21:33:40 +0800 |
| commit | 176830fe2bb1c80ee128e515f6223cddc8b0a2ca (patch) | |
| tree | 1fc24ddd49184a44761dd37fc03f73c01c2e8f60 | |
| parent | 3f069bd796b0024033640051b5f74ba9834985f8 (diff) | |
| download | emacs-176830fe2bb1c80ee128e515f6223cddc8b0a2ca.tar.gz emacs-176830fe2bb1c80ee128e515f6223cddc8b0a2ca.zip | |
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.el | 15 |
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 @@ | |||
| 86 | 86 | ||
| 87 | (declare-function treesit-search-subtree "treesit.c") | 87 | (declare-function treesit-search-subtree "treesit.c") |
| 88 | (declare-function treesit-search-forward "treesit.c") | 88 | (declare-function treesit-search-forward "treesit.c") |
| 89 | (declare-function treesit-subtree-stat "treesit.c") | ||
| 89 | (declare-function treesit-induce-sparse-tree "treesit.c") | 90 | (declare-function treesit-induce-sparse-tree "treesit.c") |
| 90 | 91 | ||
| 91 | (declare-function treesit-available-p "treesit.c") | 92 | (declare-function treesit-available-p "treesit.c") |
| @@ -265,12 +266,14 @@ If INCLUDE-NODE is non-nil, return NODE if it satisfies PRED." | |||
| 265 | Use the first parser in the parser list if LANGUAGE is omitted. | 266 | Use the first parser in the parser list if LANGUAGE is omitted. |
| 266 | If LANGUAGE is non-nil, use the first parser for LANGUAGE in the | 267 | If LANGUAGE is non-nil, use the first parser for LANGUAGE in the |
| 267 | parser list, or create one if none exists." | 268 | parser list, or create one if none exists." |
| 268 | (if-let ((parser | 269 | ;; Otherwise the incremental build is broken without tree-sitter. |
| 269 | (if language | 270 | (when (treesit-available-p) |
| 270 | (treesit-parser-create language) | 271 | (if-let ((parser |
| 271 | (or (car (treesit-parser-list)) | 272 | (if language |
| 272 | (signal 'treesit-no-parser (list (current-buffer))))))) | 273 | (treesit-parser-create language) |
| 273 | (treesit-parser-root-node parser))) | 274 | (or (car (treesit-parser-list)) |
| 275 | (signal 'treesit-no-parser (list (current-buffer))))))) | ||
| 276 | (treesit-parser-root-node parser)))) | ||
| 274 | 277 | ||
| 275 | (defun treesit-filter-child (node pred &optional named) | 278 | (defun treesit-filter-child (node pred &optional named) |
| 276 | "Return children of NODE that satisfies predicate PRED. | 279 | "Return children of NODE that satisfies predicate PRED. |