[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 fa8cc4c9ee2: Fix cmake-ts-mode indentation (Bug#66845)
From: |
Eli Zaretskii |
Subject: |
emacs-29 fa8cc4c9ee2: Fix cmake-ts-mode indentation (Bug#66845) |
Date: |
Wed, 8 Nov 2023 07:33:06 -0500 (EST) |
branch: emacs-29
commit fa8cc4c9ee271d88d52f2573d7d1ef54c7d0ca8e
Author: Randy Taylor <dev@rjt.dev>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix cmake-ts-mode indentation (Bug#66845)
* lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode--indent-rules):
Support versions v0.3.0 and v0.4.0 of the grammar.
(cmake-ts-mode--font-lock-compatibility-fe9b5e0): Fix docstring.
---
lisp/progmodes/cmake-ts-mode.el | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el
index 53d471c381a..8fcdcaddc7b 100644
--- a/lisp/progmodes/cmake-ts-mode.el
+++ b/lisp/progmodes/cmake-ts-mode.el
@@ -63,7 +63,15 @@
((parent-is "foreach_loop") parent-bol cmake-ts-mode-indent-offset)
((parent-is "function_def") parent-bol cmake-ts-mode-indent-offset)
((parent-is "if_condition") parent-bol cmake-ts-mode-indent-offset)
- ((parent-is "normal_command") parent-bol cmake-ts-mode-indent-offset)))
+ ((parent-is "normal_command") parent-bol cmake-ts-mode-indent-offset)
+ ;;; Release v0.4.0 wraps arguments in an argument_list node.
+ ,@(ignore-errors
+ (treesit-query-capture 'cmake '((argument_list) @capture))
+ `(((parent-is "argument_list") grand-parent
cmake-ts-mode-indent-offset)))
+ ;;; Release v0.3.0 wraps the body of commands into a body node.
+ ,@(ignore-errors
+ (treesit-query-capture 'cmake '((body) @capture))
+ `(((parent-is "body") grand-parent cmake-ts-mode-indent-offset)))))
"Tree-sitter indent rules for `cmake-ts-mode'.")
(defvar cmake-ts-mode--constants
@@ -89,8 +97,8 @@
"CMake if conditions for tree-sitter font-locking.")
(defun cmake-ts-mode--font-lock-compatibility-fe9b5e0 ()
- "Indent rules helper, to handle different releases of tree-sitter-cmake.
-Check if a node type is available, then return the right indent rules."
+ "Font lock helper, to handle different releases of tree-sitter-cmake.
+Check if a node type is available, then return the right font lock rules."
;; handle commit fe9b5e0
(condition-case nil
(progn (treesit-query-capture 'cmake '((argument_list) @capture))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 fa8cc4c9ee2: Fix cmake-ts-mode indentation (Bug#66845),
Eli Zaretskii <=