[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 5b705bc 2/3: Indent '.' relative to the first sib
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] emacs-25 5b705bc 2/3: Indent '.' relative to the first sibling expression |
Date: |
Sun, 13 Mar 2016 23:46:05 +0000 |
branch: emacs-25
commit 5b705bc97d3928e6550d271c415c54e00e020011
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Indent '.' relative to the first sibling expression
* 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 | 4 +++-
test/indent/ruby.rb | 5 +++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index b0b837a..9884b7e 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -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")
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index 51923f7..941fffb 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -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