]> git.eshelyaron.com Git - emacs.git/commitdiff
ruby-mode: Fix method call indentation in rhs of multiple assignment
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 28 Feb 2023 21:00:42 +0000 (23:00 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 28 Feb 2023 21:01:04 +0000 (23:01 +0200)
* 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
test/lisp/progmodes/ruby-mode-resources/ruby.rb

index 559b62fef547aa655f299fc58552fa7547f5cd57..beccb8182a75b1c4e514959a42d09056deb86bf4 100644 (file)
@@ -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
index 3f0dfdf68ba842757d72045408e588be27c31843..81d0dfd75c99745ba0a64b497f0e544897c754f4 100644 (file)
@@ -163,6 +163,11 @@ if something == :==
   )
 end
 
+# Bug#61871
+foo, bar = baz.(
+  some_arg
+)
+
 # Bug#17097
 if x == :!=
   something