diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2023-02-27 02:05:56 +0200 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2023-02-27 02:06:20 +0200 |
commit | 267fc6d00c4db6f20da3c2d63e48a71ab70505d3 (patch) | |
tree | 65ff57167ed036baffcd4f27d2db6264a843fe7b | |
parent | 0fde314f6f6e6664cddab1b2f0fe20629cd39d14 (diff) | |
download | emacs-267fc6d00c4db6f20da3c2d63e48a71ab70505d3.tar.gz |
ruby-smie-rules: Fix misindentation of a method call after assignment
* 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.
-rw-r--r-- | lisp/progmodes/ruby-mode.el | 4 | ||||
-rw-r--r-- | test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index dba9ff0a846..559b62fef54 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -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))) diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb b/test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb index 25cd8736f97..e339d229d3e 100644 --- a/test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb +++ b/test/lisp/progmodes/ruby-mode-resources/ruby-after-operator-indent.rb @@ -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 |