[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 94e330243e: ruby-ts-mode: Indentation fixes
From: |
Dmitry Gutov |
Subject: |
emacs-29 94e330243e: ruby-ts-mode: Indentation fixes |
Date: |
Mon, 2 Jan 2023 19:26:35 -0500 (EST) |
branch: emacs-29
commit 94e330243e14200ba6b45e696e6a80c611438dec
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
ruby-ts-mode: Indentation fixes
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--align-keywords):
Fix for 'def' (which was misread as 'method' in the check).
(ruby-ts--indent-rules): Indent the curly block closer the same
way as the 'do ... end' closer.
---
lisp/progmodes/ruby-ts-mode.el | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el
index 96596cb5da..6fb6f71991 100644
--- a/lisp/progmodes/ruby-ts-mode.el
+++ b/lisp/progmodes/ruby-ts-mode.el
@@ -355,8 +355,11 @@ Otherwise return start of PRED."
(lambda (node parent bol &rest rest)
(let* ((pred-node (funcall pred node parent bol rest))
(temp (treesit-node-start pred-node))
- (keyword (treesit-node-type pred-node))
- (bol (ruby-smie--indent-to-stmt-p keyword)))
+ (type (treesit-node-type pred-node))
+ (bol (ruby-smie--indent-to-stmt-p
+ (if (equal type "method")
+ "def"
+ type))))
(when temp
(if bol
(save-excursion
@@ -736,7 +739,7 @@ i.e. expr of def foo(args) = expr is returned."
((match "end" "do_block") parent-bol 0)
((n-p-gp "block_body" "block" nil) parent-bol ruby-indent-level)
((n-p-gp nil "block_body" "block") (ruby-ts--bol
ruby-ts--grand-parent-node) ruby-indent-level)
- ((match "}" "block") (ruby-ts--bol ruby-ts--grand-parent-node) 0)
+ ((match "}" "block") parent-bol 0)
;; Chained strings
((match "string" "chained_string") first-sibling 0)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 94e330243e: ruby-ts-mode: Indentation fixes,
Dmitry Gutov <=