comparison lisp/replace.el @ 56006:21eb4b5cef9a

(perform-replace): Use `limit' to terminate the while-loop explicitly.
author Juri Linkov <juri@jurta.org>
date Thu, 10 Jun 2004 04:21:14 +0000
parents 0311117a7581
children dbab365230eb
comparison
equal deleted inserted replaced
56005:54d79ab53dd3 56006:21eb4b5cef9a
1130 (push-mark) 1130 (push-mark)
1131 (undo-boundary) 1131 (undo-boundary)
1132 (unwind-protect 1132 (unwind-protect
1133 ;; Loop finding occurrences that perhaps should be replaced. 1133 ;; Loop finding occurrences that perhaps should be replaced.
1134 (while (and keep-going 1134 (while (and keep-going
1135 (not (eobp)) 1135 (not (or (eobp) (and limit (>= (point) limit))))
1136 ;; Use the next match if it is already known; 1136 ;; Use the next match if it is already known;
1137 ;; otherwise, search for a match after moving forward 1137 ;; otherwise, search for a match after moving forward
1138 ;; one char if progress is required. 1138 ;; one char if progress is required.
1139 (setq real-match-data 1139 (setq real-match-data
1140 (if (consp match-again) 1140 (if (consp match-again)
1146 ;; we don't, move one char to the 1146 ;; we don't, move one char to the
1147 ;; right. This takes us a 1147 ;; right. This takes us a
1148 ;; character too far at the end, 1148 ;; character too far at the end,
1149 ;; but this is undone after the 1149 ;; but this is undone after the
1150 ;; while-loop. 1150 ;; while-loop.
1151 (progn (forward-char 1) (not (eobp)))) 1151 (progn
1152 (forward-char 1)
1153 (not (or (eobp)
1154 (and limit (>= (point) limit))))))
1152 (funcall search-function search-string limit t) 1155 (funcall search-function search-string limit t)
1153 ;; For speed, use only integers and 1156 ;; For speed, use only integers and
1154 ;; reuse the list used last time. 1157 ;; reuse the list used last time.
1155 (match-data t real-match-data))))) 1158 (match-data t real-match-data)))))
1156 ;; Optionally ignore matches that have a read-only property. 1159 ;; Optionally ignore matches that have a read-only property.