diff lisp/replace.el @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents aabb7f5b1c81
children 697ef44129c6
line wrap: on
line diff
--- a/lisp/replace.el	Mon Aug 13 11:12:06 2007 +0200
+++ b/lisp/replace.el	Mon Aug 13 11:13:30 2007 +0200
@@ -679,6 +679,7 @@
 	;; Loop finding occurrences that perhaps should be replaced.
 	(while (and keep-going
 		    (not (eobp))
+		    (or (null limit) (< (point) limit))
 		    (let ((case-fold-search qr-case-fold-search))
 		      (funcall search-function search-string limit))
 		    ;; If the search string matches immediately after
@@ -688,7 +689,8 @@
 			    (and regexp-flag
 				 (eq lastrepl (match-beginning 0))
 				 (not match-again)))
-			(if (eobp)
+			(if (or (eobp)
+				(and limit (>= (point) limit)))
 			    nil
 			  ;; Don't replace the null string 
 			  ;; right after end of previous replacement.