From: Dmitry Gutov Date: Thu, 19 Dec 2013 05:06:24 +0000 (+0200) Subject: * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent middle-of-block X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~331 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ce41edb426ccd6acc1c653d8a9a28aded9e9d594;p=emacs.git * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent middle-of-block keywords to their parent. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 09d4cebb6f5..5fd4ff56c66 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-12-19 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-smie-rules): Indent middle-of-block + keywords to their parent. + 2013-12-19 Dmitry Gutov * progmodes/ruby-mode.el (ruby-smie--args-separator-p): Allow the diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index e291acec327..449a10dc999 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -569,8 +569,9 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." (cons 'column (current-column))))) (`(:before . "do") (ruby-smie--indent-to-stmt)) (`(:before . ".") ruby-indent-level) - (`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure")) 0) - (`(:before . ,(or `"when")) + (`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure")) + (smie-rule-parent)) + (`(:before . "when") (if (not (smie-rule-sibling-p)) 0)) ;; ruby-indent-level (`(:after . ,(or "=" "iuwu-mod" "+" "-" "*" "/" "&&" "||" "%" "**" "^" "&" "<=>" ">" "<" ">=" "<=" "==" "===" "!=" "<<" ">>" diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index 0bf4bc14fbb..1993c29efb3 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb @@ -272,6 +272,8 @@ end # http://stackoverflow.com/questions/17786563/emacs-ruby-mode-if-expressions-indentation tee = if foo bar + else + tee end a = b { @@ -328,6 +330,8 @@ def qux foo ||= begin bar tee + rescue + oomph end end