Fix c-ts-mode--emacs-c-range-query

* lisp/progmodes/c-ts-mode.el (c-ts-mode--emacs-c-range-query):
Check for (treesit-available-p).
This commit is contained in:
Michael Albinus 2023-04-30 12:11:00 +02:00
parent 7f94558b77
commit 610a7657e0

View 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