]> code.delx.au - gnu-emacs/commitdiff
Indent '.' relative to the first sibling expression
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 13 Mar 2016 22:15:06 +0000 (00:15 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 13 Mar 2016 23:45:01 +0000 (01:45 +0200)
* lisp/progmodes/ruby-mode.el (ruby-smie-rules):
Indent '.' relative to the first sibling expression, instead of the
parent token (bug#17213).

lisp/progmodes/ruby-mode.el
test/indent/ruby.rb

index b0b837aa20efbbf059e77f771297493575a3788a..9884b7e1ac1f6ce6e3bee84f8d05bbfcacc58f92 100644 (file)
@@ -661,7 +661,9 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
     (`(:before . ".")
      (if (smie-rule-sibling-p)
          (and ruby-align-chained-calls 0)
-       ruby-indent-level))
+       (smie-backward-sexp ".")
+       (cons 'column (+ (current-column)
+                        ruby-indent-level))))
     (`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure"))
      (smie-rule-parent))
     (`(:before . "when")
index 51923f79373e6e8a0f46f418879e8ba61ea18eb7..941fffb2209a31cabdd58f706b2456895820f4d5 100644 (file)
@@ -317,6 +317,11 @@ def bar
     .baz
 end
 
+abc(foo
+      .bar,
+    tee
+      .qux)
+
 # http://stackoverflow.com/questions/17786563/emacs-ruby-mode-if-expressions-indentation
 tee = if foo
         bar