comparison 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
comparison
equal deleted inserted replaced
354:3729bef672e0 355:182f72e8cd0d
655 (undo-boundary) 655 (undo-boundary)
656 (unwind-protect 656 (unwind-protect
657 ;; Loop finding occurrences that perhaps should be replaced. 657 ;; Loop finding occurrences that perhaps should be replaced.
658 (while (and keep-going 658 (while (and keep-going
659 (not (eobp)) 659 (not (eobp))
660 (or (null limit) (< (point) limit))
660 (let ((case-fold-search qr-case-fold-search)) 661 (let ((case-fold-search qr-case-fold-search))
661 (funcall search-function search-string limit t)) 662 (funcall search-function search-string limit t))
662 ;; If the search string matches immediately after 663 ;; If the search string matches immediately after
663 ;; the previous match, but it did not match there 664 ;; the previous match, but it did not match there
664 ;; before the replacement was done, ignore the match. 665 ;; before the replacement was done, ignore the match.
665 (if (or (eq lastrepl (point)) 666 (if (or (eq lastrepl (point))
666 (and regexp-flag 667 (and regexp-flag
667 (eq lastrepl (match-beginning 0)) 668 (eq lastrepl (match-beginning 0))
668 (not match-again))) 669 (not match-again)))
669 (if (eobp) 670 (if (or (eobp)
671 (and limit (>= (point) limit)))
670 nil 672 nil
671 ;; Don't replace the null string 673 ;; Don't replace the null string
672 ;; right after end of previous replacement. 674 ;; right after end of previous replacement.
673 (forward-char 1) 675 (forward-char 1)
674 (let ((case-fold-search qr-case-fold-search)) 676 (let ((case-fold-search qr-case-fold-search))