summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-04-30 12:11:00 +0200
committerMichael Albinus <michael.albinus@gmx.de>2023-04-30 12:11:00 +0200
commit610a7657e0aeaaf6299de76f13a6dc6e4af7db96 (patch)
tree5d8b5d73edfdd0a888d741ca1df3c51c98783950 /lisp
parent7f94558b775e36042b28d3df6460463bd112dfda (diff)
downloademacs-610a7657e0aeaaf6299de76f13a6dc6e4af7db96.tar.gz
emacs-610a7657e0aeaaf6299de76f13a6dc6e4af7db96.tar.bz2
emacs-610a7657e0aeaaf6299de76f13a6dc6e4af7db96.zip
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).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/c-ts-mode.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 0fa53e06962..1186bd5b8df 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -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