]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Only align with parent of
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 23 Oct 2013 17:55:53 +0000 (13:55 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 23 Oct 2013 17:55:53 +0000 (13:55 -0400)
{ if it is hanging.

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

index 63156bb18a1c451e5664998bed179c5b9c6750d9..6210bbeabae7d0beb024e5ac1071b5fb59ae5374 100644 (file)
@@ -1,5 +1,8 @@
 2013-10-23  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * progmodes/ruby-mode.el (ruby-smie-rules): Only align with parent of
+       { if it is hanging.
+
        * progmodes/ruby-mode.el (ruby-smie-rules): Don't return 0 for
        :before ";".
 
index 7b9dcd44b2432e6a3896ebc88638872277e2be3c..88820a4a94268b74cfbd982533453015dfbf0f5a 100644 (file)
@@ -449,7 +449,7 @@ explicitly declared in magic comment."
       ((smie-rule-parent-p "def" "begin" "do" "class" "module" "for"
                            "while" "until" "unless"
                            "if" "then" "elsif" "else" "when"
-                           "rescue" "ensure" "{")
+                           "rescue" "ensure")
        (smie-rule-parent ruby-indent-level))
       ;; For (invalid) code between switch and case.
       ;; (if (smie-parent-p "switch") 4)
@@ -457,7 +457,9 @@ explicitly declared in magic comment."
     (`(:before . ,(or `"(" `"[" `"{"))
      (cond
       ((and (equal token "{")
-            (not (smie-rule-prev-p "(" "{" "[" "," "=>")))
+            (not (smie-rule-prev-p "(" "{" "[" "," "=>"))
+           (or (smie-rule-hanging-p)
+               (smie-rule-next-p "opening-|")))
        ;; Curly block opener.
        (smie-rule-parent))
       ((smie-rule-hanging-p)
index 7ce60f5f58b5e51318741ac86d6f32033702452a..7601738dc76a839289b5b224a9ccf56d9736ca30 100644 (file)
@@ -40,6 +40,10 @@ foo = {                         # ruby-deep-indent-disabled
   a: b
 }
 
+foo = { a: b
+        a1: b1
+      }
+
 foo({
      a: b,
      c: d