XEmacs 21.2.36 "Notos"
[chise/xemacs-chise.git.1] / lisp / replace.el
index 3b6165e..990625b 100644 (file)
@@ -604,7 +604,7 @@ The valid answers include `act', `skip', `act-and-show',
 
 ;; XEmacs
 (defun perform-replace-next-event (event)
-  (if isearch-highlight
+  (if search-highlight
       (let ((aborted t))
        (unwind-protect
            (progn
@@ -679,6 +679,7 @@ When searching for a match, this function use `replace-search-function' and `rep
        ;; 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 @@ When searching for a match, this function use `replace-search-function' and `rep
                            (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.