From: Richard M. Stallman Date: Sun, 11 Feb 2007 11:12:20 +0000 (+0000) Subject: (indent-sexp): Clean up termination condition -- don't fail to stop at endpos. X-Git-Tag: emacs-pretest-22.0.94~274 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9f25c0d219dc1a51761ae397759613894306f0e2;p=emacs.git (indent-sexp): Clean up termination condition -- don't fail to stop at endpos. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1a7beefee1c..82417c2f4d0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2007-02-11 Richard Stallman + + * loadhist.el (unload-feature): Handle (t . SYMBOL) entries + in load history. + + * emacs-lisp/lisp-mode.el (indent-sexp): Clean up termination + condition -- don't fail to stop at endpos. + 2007-02-11 Carsten Dominik * textmodes/org.el (org-agenda-get-todos) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index abc795481a4..8c1cf918b36 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1130,19 +1130,25 @@ ENDPOS is encountered." (make-list (- next-depth) nil)) last-depth (- last-depth next-depth) next-depth 0))) - (or outer-loop-done endpos - (setq outer-loop-done (<= next-depth 0))) - (if outer-loop-done - (forward-line 1) + (forward-line 1) + ;; Decide whether to exit. + (if endpos + ;; If we have already reached the specified end, + ;; give up and do not reindent this line. + (if (<= endpos (point)) + (setq outer-loop-done t)) + ;; If no specified end, we are done if we have finished one sexp. + (if (<= next-depth 0) + (setq outer-loop-done t))) + (unless outer-loop-done (while (> last-depth next-depth) (setq indent-stack (cdr indent-stack) last-depth (1- last-depth))) (while (< last-depth next-depth) (setq indent-stack (cons nil indent-stack) last-depth (1+ last-depth))) - ;; Now go to the next line and indent it according + ;; Now indent the next line according ;; to what we learned from parsing the previous one. - (forward-line 1) (setq bol (point)) (skip-chars-forward " \t") ;; But not if the line is blank, or just a comment