[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 48a0804d10d: ruby-mode: Fix method call indentation in rhs of m
From: |
Dmitry Gutov |
Subject: |
emacs-29 48a0804d10d: ruby-mode: Fix method call indentation in rhs of multiple assignment |
Date: |
Tue, 28 Feb 2023 16:01:31 -0500 (EST) |
branch: emacs-29
commit 48a0804d10d02c2aa94664e0db8315239950225f
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
ruby-mode: Fix method call indentation in rhs of multiple assignment
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Special-case
assignment that follows a comma-separated list (bug#61871).
* test/lisp/progmodes/ruby-mode-resources/ruby.rb: Add case.
---
lisp/progmodes/ruby-mode.el | 13 ++++++++-----
test/lisp/progmodes/ruby-mode-resources/ruby.rb | 5 +++++
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 559b62fef54..beccb8182a7 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -916,11 +916,14 @@ This only affects the output of the command
`ruby-toggle-block'."
(smie-indent--hanging-p))
ruby-indent-level)))
(`(:before . "=")
- (save-excursion
- (and (smie-rule-parent-p " @ ")
- (goto-char (nth 1 (smie-indent--parent)))
- (smie-rule-prev-p "def=")
- (cons 'column (+ (current-column) ruby-indent-level -3)))))
+ (or
+ (save-excursion
+ (and (smie-rule-parent-p " @ ")
+ (goto-char (nth 1 (smie-indent--parent)))
+ (smie-rule-prev-p "def=")
+ (cons 'column (+ (current-column) ruby-indent-level -3))))
+ (and (smie-rule-parent-p ",")
+ (smie-rule-parent))))
(`(:after . ,(or "?" ":"))
(if ruby-after-operator-indent
ruby-indent-level
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb
b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
index 3f0dfdf68ba..81d0dfd75c9 100644
--- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb
+++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
@@ -163,6 +163,11 @@ if something == :==
)
end
+# Bug#61871
+foo, bar = baz.(
+ some_arg
+)
+
# Bug#17097
if x == :!=
something
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 48a0804d10d: ruby-mode: Fix method call indentation in rhs of multiple assignment,
Dmitry Gutov <=