emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tree sitter failures


From: Po Lu
Subject: tree sitter failures
Date: Mon, 30 Jan 2023 21:32:30 +0800

Since some recent change the incremental build has stopped working, with
the byte-compiler complaining that it cannot find `treesit-buffer-root-node'.
I have installed this change to fix it.

But why is pcase-let or the byte compiler evaluating a binding during
macro expansion? That sounds like a bug somewhere.

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 @@ treesit-buffer-root-node
 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]