* lisp/progmodes/ruby-mode.el (ruby-smie--bosp): Anything that goes
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 27 Oct 2013 03:25:03 +0000 (07:25 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 27 Oct 2013 03:25:03 +0000 (07:25 +0400)
after `=' is probably a new expression.

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

index 8b31efc..96f3ab2 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-27  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * progmodes/ruby-mode.el (ruby-smie--bosp): Anything that goes
+       after `=' is probably a new expression.
+
 2013-10-27  RĂ¼diger Sonderfeld  <ruediger@c-plusplus.de>
 
        * man.el (man-imenu-title): New option.
index b85385a..441f166 100644 (file)
@@ -334,7 +334,7 @@ explicitly declared in magic comment."
 
 (defun ruby-smie--bosp ()
   (save-excursion (skip-chars-backward " \t")
-                  (or (bolp) (eq (char-before) ?\;))))
+                  (or (bolp) (memq (char-before) '(?\; ?=)))))
 
 (defun ruby-smie--implicit-semi-p ()
   (save-excursion
index b4173b6..633b299 100644 (file)
@@ -220,6 +220,11 @@ def bar
     .baz
 end
 
+# http://stackoverflow.com/questions/17786563/emacs-ruby-mode-if-expressions-indentation
+tee = if foo
+        bar
+      end
+
 # Examples below still fail with `ruby-use-smie' on:
 
 foo = [1, 2, 3].map do |i|