all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: emacs-devel@gnu.org
Subject: tree sitter failures
Date: Mon, 30 Jan 2023 21:32:30 +0800	[thread overview]
Message-ID: <87lelkywpd.fsf@yahoo.com> (raw)
In-Reply-To: 87lelkywpd.fsf.ref@yahoo.com

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	other threads:[~2023-01-30 13:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87lelkywpd.fsf.ref@yahoo.com>
2023-01-30 13:32 ` Po Lu [this message]
2023-01-30 13:40   ` tree sitter failures Po Lu
2023-01-30 14:25   ` Eli Zaretskii
2023-01-30 14:35     ` Po Lu
2023-01-30 18:30       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lelkywpd.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.