]> git.eshelyaron.com Git - emacs.git/commitdiff
ruby-smie-rules: Fix misindentation of a method call after assignment
authorDmitry Gutov <dgutov@yandex.ru>
Mon, 27 Feb 2023 00:05:56 +0000 (02:05 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Mon, 27 Feb 2023 00:06:20 +0000 (02:06 +0200)
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Fix indentation of a
method call after assignment with ruby-after-operator-indent=nil
(bug#61822).

* test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb:
Add corresponding example.

lisp/progmodes/ruby-mode.el
test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb

index dba9ff0a846639abc19a2330058af7a2c70bbf1a..559b62fef547aa655f299fc58552fa7547f5cd57 100644 (file)
@@ -909,7 +909,9 @@ This only affects the output of the command `ruby-toggle-block'."
                      "<<=" ">>=" "&&=" "||=" "and" "or"))
      (cond
       ((not ruby-after-operator-indent)
-       (ruby-smie--indent-to-stmt ruby-indent-level))
+       (ruby-smie--indent-to-stmt (if (smie-indent--hanging-p)
+                                      ruby-indent-level
+                                    0)))
       ((and (smie-rule-parent-p ";" nil)
             (smie-indent--hanging-p))
        ruby-indent-level)))
index 25cd8736f973024335218a88ef726398f1e4f9f2..e339d229d3ea45759a265c7e25245503df144484 100644 (file)
@@ -10,6 +10,10 @@ qux = 4 + 5 *
 foo = obj.bar { |m| tee(m) } +
   obj.qux { |m| hum(m) }
 
+some_variable = abc + some_method(
+  some_argument
+)
+
 foo.
   bar
   .baz