diff lisp/replace.el @ 355:182f72e8cd0d r21-1-7

Import from CVS: tag r21-1-7
author cvs
date Mon, 13 Aug 2007 10:56:21 +0200
parents c42ec1d1cded
children 1d62742628b6
line wrap: on
line diff
--- a/lisp/replace.el	Mon Aug 13 10:55:35 2007 +0200
+++ b/lisp/replace.el	Mon Aug 13 10:56:21 2007 +0200
@@ -657,6 +657,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 t))
 		    ;; If the search string matches immediately after
@@ -666,7 +667,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.