changeset 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 54d79ab53dd3
children 8446511392c6
files lisp/replace.el
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/replace.el	Thu Jun 10 04:20:02 2004 +0000
+++ b/lisp/replace.el	Thu Jun 10 04:21:14 2004 +0000
@@ -1132,7 +1132,7 @@
     (unwind-protect
 	;; Loop finding occurrences that perhaps should be replaced.
 	(while (and keep-going
-		    (not (eobp))
+		    (not (or (eobp) (and limit (>= (point) limit))))
 		    ;; Use the next match if it is already known;
 		    ;; otherwise, search for a match after moving forward
 		    ;; one char if progress is required.
@@ -1148,7 +1148,10 @@
 				     ;; character too far at the end,
 				     ;; but this is undone after the
 				     ;; while-loop.
-				     (progn (forward-char 1) (not (eobp))))
+				     (progn
+				       (forward-char 1)
+				       (not (or (eobp)
+						(and limit (>= (point) limit))))))
 				 (funcall search-function search-string limit t)
 				 ;; For speed, use only integers and
 				 ;; reuse the list used last time.