emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8bb5d7a 2/5: * lisp/emacs-lisp/lisp-mode.el (indent


From: Noam Postavsky
Subject: [Emacs-diffs] master 8bb5d7a 2/5: * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Clean up marker.
Date: Sat, 22 Apr 2017 14:17:51 -0400 (EDT)

branch: master
commit 8bb5d7adaf45264900385530c7f76175ba490a77
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Clean up marker.
---
 lisp/emacs-lisp/lisp-mode.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 607a4c3..810fc95 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1089,12 +1089,13 @@ ENDPOS is encountered."
          (next-depth init-depth)
          (last-depth init-depth)
          (last-syntax-point (point)))
-    (unless endpos
-      ;; Get error now if we don't have a complete sexp after point.
-      (save-excursion (forward-sexp 1)
-                      ;; We need a marker because we modify the buffer
-                      ;; text preceding endpos.
-                      (setq endpos (point-marker))))
+    ;; We need a marker because we modify the buffer
+    ;; text preceding endpos.
+    (setq endpos (copy-marker
+                  (if endpos endpos
+                    ;; Get error now if we don't have a complete sexp
+                    ;; after point.
+                    (save-excursion (forward-sexp 1) (point)))))
     (save-excursion
       (while (< (point) endpos)
         ;; Parse this line so we can learn the state to indent the
@@ -1154,7 +1155,8 @@ ENDPOS is encountered."
                          ;; `calculate-lisp-indent' only returns nil
                          ;; when we're in a string, but this won't
                          ;; happen because we skip strings above.
-                         (t (error "This shouldn't happen!"))))))))))))
+                         (t (error "This shouldn't happen!"))))))))))
+    (move-marker endpos nil)))
 
 (defun indent-pp-sexp (&optional arg)
   "Indent each line of the list starting just after point, or prettyprint it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]