]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix c-ts-mode--emacs-c-range-query
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 30 Apr 2023 10:11:00 +0000 (12:11 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 30 Apr 2023 10:11:00 +0000 (12:11 +0200)
* lisp/progmodes/c-ts-mode.el (c-ts-mode--emacs-c-range-query):
Check for (treesit-available-p).

lisp/progmodes/c-ts-mode.el

index 0fa53e06962e78c5d1a4d1a3dc376eac8de5f043..1186bd5b8df2346355d194ba905162c11f78e2a1 100644 (file)
@@ -1025,13 +1025,14 @@ For BOL see `treesit-simple-indent-rules'."
       (looking-at c-ts-mode--for-each-tail-regexp))))
 
 (defvar c-ts-mode--emacs-c-range-query
-  (treesit-query-compile
-   'emacs-c `(((declaration
-                type: (macro_type_specifier
-                       name: (identifier) @_name)
-                @for-each-tail)
-               (:match ,c-ts-mode--for-each-tail-regexp
-                       @_name))))
+  (when (treesit-available-p)
+    (treesit-query-compile
+     'emacs-c `(((declaration
+                  type: (macro_type_specifier
+                         name: (identifier) @_name)
+                  @for-each-tail)
+                 (:match ,c-ts-mode--for-each-tail-regexp
+                         @_name)))))
   "Query that finds a FOR_EACH_* macro with an unbracketed body.")
 
 (defvar-local c-ts-mode--for-each-tail-ranges nil