emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 610a7657e0a: Fix c-ts-mode--emacs-c-range-query


From: Michael Albinus
Subject: emacs-29 610a7657e0a: Fix c-ts-mode--emacs-c-range-query
Date: Sun, 30 Apr 2023 06:11:25 -0400 (EDT)

branch: emacs-29
commit 610a7657e0aeaaf6299de76f13a6dc6e4af7db96
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    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).
---
 lisp/progmodes/c-ts-mode.el | 15 ++++++++-------
 1 file 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]