emacs-diffs
[Top][All Lists]
Advanced

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

master 7d246c359cf: ; * lisp/progmodes/c-ts-mode.el: allow loading file


From: Mattias Engdegård
Subject: master 7d246c359cf: ; * lisp/progmodes/c-ts-mode.el: allow loading file without treesit
Date: Mon, 1 May 2023 13:10:00 -0400 (EDT)

branch: master
commit 7d246c359cf3d25cab5134076e393c4d25015827
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    ; * lisp/progmodes/c-ts-mode.el: allow loading file without treesit
---
 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 4971ed0b7c2..1f420689432 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -1001,13 +1001,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))))
+  (and (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]