comparison lisp/emacs-lisp/lisp-mode.el @ 75798:8496bd7b062a

(indent-sexp): Clean up termination condition -- don't fail to stop at endpos.
author Richard M. Stallman <rms@gnu.org>
date Sun, 11 Feb 2007 11:11:54 +0000
parents 0c165a40f76b
children 2e16068bd4fb 52a7f3f50b89
comparison
equal deleted inserted replaced
75797:1c398694f7b2 75798:8496bd7b062a
1128 (progn 1128 (progn
1129 (setq indent-stack (nconc indent-stack 1129 (setq indent-stack (nconc indent-stack
1130 (make-list (- next-depth) nil)) 1130 (make-list (- next-depth) nil))
1131 last-depth (- last-depth next-depth) 1131 last-depth (- last-depth next-depth)
1132 next-depth 0))) 1132 next-depth 0)))
1133 (or outer-loop-done endpos 1133 (forward-line 1)
1134 (setq outer-loop-done (<= next-depth 0))) 1134 ;; Decide whether to exit.
1135 (if outer-loop-done 1135 (if endpos
1136 (forward-line 1) 1136 ;; If we have already reached the specified end,
1137 ;; give up and do not reindent this line.
1138 (if (<= endpos (point))
1139 (setq outer-loop-done t))
1140 ;; If no specified end, we are done if we have finished one sexp.
1141 (if (<= next-depth 0)
1142 (setq outer-loop-done t)))
1143 (unless outer-loop-done
1137 (while (> last-depth next-depth) 1144 (while (> last-depth next-depth)
1138 (setq indent-stack (cdr indent-stack) 1145 (setq indent-stack (cdr indent-stack)
1139 last-depth (1- last-depth))) 1146 last-depth (1- last-depth)))
1140 (while (< last-depth next-depth) 1147 (while (< last-depth next-depth)
1141 (setq indent-stack (cons nil indent-stack) 1148 (setq indent-stack (cons nil indent-stack)
1142 last-depth (1+ last-depth))) 1149 last-depth (1+ last-depth)))
1143 ;; Now go to the next line and indent it according 1150 ;; Now indent the next line according
1144 ;; to what we learned from parsing the previous one. 1151 ;; to what we learned from parsing the previous one.
1145 (forward-line 1)
1146 (setq bol (point)) 1152 (setq bol (point))
1147 (skip-chars-forward " \t") 1153 (skip-chars-forward " \t")
1148 ;; But not if the line is blank, or just a comment 1154 ;; But not if the line is blank, or just a comment
1149 ;; (except for double-semi comments; indent them as usual). 1155 ;; (except for double-semi comments; indent them as usual).
1150 (if (or (eobp) (looking-at "\\s<\\|\n")) 1156 (if (or (eobp) (looking-at "\\s<\\|\n"))