diff lisp/emacs-lisp/lisp-mode.el @ 727:540b047ece4d

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Wed, 24 Jun 1992 05:09:26 +0000
parents 7a9b4ea68565
children 4f28bd14272c
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp-mode.el	Wed Jun 24 05:07:51 1992 +0000
+++ b/lisp/emacs-lisp/lisp-mode.el	Wed Jun 24 05:09:26 1992 +0000
@@ -490,9 +490,11 @@
 If optional arg ENDPOS is given, indent each line, stopping when
 ENDPOS is encountered."
   (interactive)
-  (let ((indent-stack (list nil)) (next-depth 0) last-depth bol
-	outer-loop-done inner-loop-done state this-indent
-	(last-point (point)))
+  (let ((indent-stack (list nil))
+	(next-depth 0)
+	(starting-point (point))
+	(last-point (point))
+	last-depth bol outer-loop-done inner-loop-done state this-indent)
     ;; Get error now if we don't have a complete sexp after point.
     (save-excursion (forward-sexp 1))
     (save-excursion
@@ -529,10 +531,12 @@
 		(setcar (nthcdr 5 state) nil))
 	    (setq inner-loop-done t)))
 	(and endpos
-	     (while (<= next-depth 0)
-	       (setq indent-stack (append indent-stack (list nil)))
-	       (setq next-depth (1+ next-depth))
-	       (setq last-depth (1+ last-depth))))
+	     (<= next-depth 0)
+	     (progn
+	       (setq indent-stack (append indent-stack
+					  (make-list (- next-depth) nil))
+		     last-depth (- last-depth next-depth)
+		     next-depth 0)))
 	(or outer-loop-done
 	    (setq outer-loop-done (<= next-depth 0)))
 	(if outer-loop-done
@@ -557,7 +561,7 @@
 		(setq this-indent (car indent-stack))
 	      (let ((val (calculate-lisp-indent
 			  (if (car indent-stack) (- (car indent-stack))
-			    last-point))))
+			    starting-point))))
 		(if (integerp val)
 		    (setcar indent-stack
 			    (setq this-indent val))