* lisp/emacs-lisp/smie.el (smie-next-sexp): Refine last fix.
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 7 Oct 2013 16:56:51 +0000 (12:56 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 7 Oct 2013 16:56:51 +0000 (12:56 -0400)
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Tweak handling of
open braces.

lisp/ChangeLog
lisp/emacs-lisp/smie.el
lisp/progmodes/ruby-mode.el

index 972eb2f..64fedd3 100644 (file)
@@ -1,5 +1,10 @@
 2013-10-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * progmodes/ruby-mode.el (ruby-smie-rules): Tweak handling of
+       open braces.
+
+       * emacs-lisp/smie.el (smie-next-sexp): Refine last fix.
+
        * textmodes/css-mode.el (css-smie-rules): Fix indentation (bug#15467).
        (css-mode): Use electric-indent-chars.
 
index e35cb4a..32dcb2e 100644 (file)
@@ -709,11 +709,13 @@ Possible return values:
                 (condition-case err
                     (progn (funcall next-sexp 1) nil)
                   (scan-error
-                   (let ((pos (nth 2 err)))
+                   (let ((epos (nth 2 err)))
+                     (goto-char pos)
                      (throw 'return
-                            (list t pos
+                            (list t epos
                                   (buffer-substring-no-properties
-                                   pos (+ pos (if (< (point) pos) -1 1))))))))
+                                   epos
+                                   (+ epos (if (< (point) epos) -1 1))))))))
                 (if (eq pos (point))
                     ;; We did not move, so let's abort the loop.
                     (throw 'return (list t (point))))))
index b8c24e8..6497fb6 100644 (file)
@@ -414,7 +414,8 @@ Also ignores spaces after parenthesis when 'space."
     (`(:before . ,(or `"(" `"[" `"{"))
      ;; Treat purely syntactic block-constructs as being part of their parent,
      ;; when the opening statement is hanging.
-     (if (smie-rule-hanging-p) (smie-rule-parent)))
+     (when (smie-rule-hanging-p)
+       (smie-backward-sexp 'halfsexp) (smie-indent-virtual)))
     (`(:after . "=") 2)
     (`(:before . "do")
      (when (or (smie-rule-hanging-p)