From: Eli Zaretskii Date: Sun, 18 Dec 2022 17:13:10 +0000 (+0200) Subject: ; Fix calls to treesit functions X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=09b5f00613572dd27f43626aed21f3659d5ced64;p=emacs.git ; Fix calls to treesit functions * 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 . --- diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index b46a9affcd3..aa37a4ac865 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -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)))))))