[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 746748f5c2: Make java-ts-mode use the c-ts-common-indent-type-r
From: |
Yuan Fu |
Subject: |
emacs-29 746748f5c2: Make java-ts-mode use the c-ts-common-indent-type-regexp-alist |
Date: |
Mon, 6 Feb 2023 21:49:09 -0500 (EST) |
branch: emacs-29
commit 746748f5c283b98a221571e725833affe304a748
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Make java-ts-mode use the c-ts-common-indent-type-regexp-alist
* lisp/progmodes/java-ts-mode.el:
(java-ts-mode): Setup c-ts-common-indent-type-regexp-alist.
---
lisp/progmodes/java-ts-mode.el | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el
index 1d7bdb0722..dc651c11a0 100644
--- a/lisp/progmodes/java-ts-mode.el
+++ b/lisp/progmodes/java-ts-mode.el
@@ -303,20 +303,22 @@ Return nil if there is no name or if NODE is not a defun
node."
(c-ts-common-comment-setup)
;; Indent.
- (setq-local c-ts-common-indent-block-type-regexp
- (regexp-opt '("class_body"
- "array_initializer"
- "constructor_body"
- "annotation_type_body"
- "interface_body"
- "enum_body"
- "switch_block"
- "record_declaration_body"
- "block")))
- (setq-local c-ts-common-indent-bracketless-type-regexp
- (regexp-opt '("if_statement"
- "for_statement"
- "while_statement")))
+ (setq-local c-ts-common-indent-type-regexp-alist
+ `((block . ,(rx (or "class_body"
+ "array_initializer"
+ "constructor_body"
+ "annotation_type_body"
+ "interface_body"
+ "enum_body"
+ "switch_block"
+ "record_declaration_body"
+ "block")))
+ (close-bracket . "}")
+ (if . "if_statement")
+ (else . ("if_statement" . "alternative"))
+ (for . "for_statement")
+ (while . "while_statement")
+ (do . "do_statement")))
(setq-local c-ts-common-indent-offset 'java-ts-mode-indent-offset)
(setq-local treesit-simple-indent-rules java-ts-mode--indent-rules)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 746748f5c2: Make java-ts-mode use the c-ts-common-indent-type-regexp-alist,
Yuan Fu <=