* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p):

Not after "||".
(ruby-smie-rules): Indent non-hanging "begin" blocks as part of
their parent.
This commit is contained in:
Dmitry Gutov 2013-11-09 01:59:56 +02:00
parent ad16897ceb
commit 1629a32997
3 changed files with 19 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2013-11-08 Dmitry Gutov <dgutov@yandex.ru>
* progmodes/ruby-mode.el (ruby-smie--implicit-semi-p):
Not after "||".
(ruby-smie-rules): Indent non-hanging "begin" blocks as part of
their parent.
2013-11-08 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/ruby-mode.el: Don't require cl any more. Use pcase instead.

View file

@ -364,6 +364,8 @@ explicitly declared in magic comment."
(and (eq (char-before) ?=)
(string-match "\\`\\s." (save-excursion
(ruby-smie--backward-token))))
(and (eq (char-before) ?|)
(eq (char-before (1- (point))) ?|))
(and (eq (car (syntax-after (1- (point)))) 2)
(member (save-excursion (ruby-smie--backward-token))
'("iuwu-mod" "and" "or")))
@ -546,6 +548,9 @@ explicitly declared in magic comment."
"+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^="
"<<=" ">>=" "&&=" "||=" "and" "or"))
(if (smie-rule-parent-p ";" nil) ruby-indent-level))
(`(:before . "begin")
(unless (save-excursion (skip-chars-backward " \t") (bolp))
(smie-rule-parent)))
))
(defun ruby-imenu-create-index-in-block (prefix beg end)

View file

@ -285,9 +285,14 @@ def bar
end
end
# Failing with SMIE:
foo ||
begin
bar
end
def qux
foo ||= begin
bar
tee
end
end