summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/progmodes/ruby-mode.el5
-rw-r--r--test/indent/ruby.rb9
3 files changed, 19 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3b30e4c7f44..794b13d752b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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.
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 69c850255d0..cb5fe11ada6 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -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)
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index 0c432b7ca20..1d2eb08db94 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -285,9 +285,14 @@ bar 1 do
end
end
-# Failing with SMIE:
-
foo ||
begin
bar
end
+
+def qux
+ foo ||= begin
+ bar
+ tee
+ end
+end