]> git.eshelyaron.com Git - emacs.git/commitdiff
; Fix calls to treesit functions
authorEli Zaretskii <eliz@gnu.org>
Sun, 18 Dec 2022 17:13:10 +0000 (19:13 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sun, 18 Dec 2022 17:13:10 +0000 (19:13 +0200)
* lisp/progmodes/prog-mode.el (treesit-available-p): Declare.
(prog-fill-reindent-defun): Only call treesit.c functions if
treesit-available-p returns non-nil.  Reported by Eduardo Ochs
<eduardoochs@gmail.com>.

lisp/progmodes/prog-mode.el

index b46a9affcd3e6d69c006949eac023c7d8a20352f..aa37a4ac865a703ad5078e2f6db402efcf7619bd 100644 (file)
@@ -33,6 +33,7 @@
                    (require 'subr-x)
                    (require 'treesit))
 
+(declare-function treesit-available-p "treesit.c")
 (declare-function treesit-parser-list "treesit.c")
 (declare-function treesit-node-type "treesit.c")
 
@@ -156,7 +157,8 @@ or follows point."
   (interactive "P")
   (save-excursion
     (let ((treesit-text-node
-           (and (treesit-parser-list)
+           (and (treesit-available-p)
+                (treesit-parser-list)
                 (string-match-p
                  treesit-text-type-regexp
                  (treesit-node-type (treesit-node-at (point)))))))