comparison lisp/replace.el @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 74fd4e045ea6
children 11054d720c21
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
677 (undo-boundary) 677 (undo-boundary)
678 (unwind-protect 678 (unwind-protect
679 ;; Loop finding occurrences that perhaps should be replaced. 679 ;; Loop finding occurrences that perhaps should be replaced.
680 (while (and keep-going 680 (while (and keep-going
681 (not (eobp)) 681 (not (eobp))
682 (or (null limit) (< (point) limit))
683 (let ((case-fold-search qr-case-fold-search)) 682 (let ((case-fold-search qr-case-fold-search))
684 (funcall search-function search-string limit)) 683 (funcall search-function search-string limit))
685 ;; If the search string matches immediately after 684 ;; If the search string matches immediately after
686 ;; the previous match, but it did not match there 685 ;; the previous match, but it did not match there
687 ;; before the replacement was done, ignore the match. 686 ;; before the replacement was done, ignore the match.
688 (if (or (eq lastrepl (point)) 687 (if (or (eq lastrepl (point))
689 (and regexp-flag 688 (and regexp-flag
690 (eq lastrepl (match-beginning 0)) 689 (eq lastrepl (match-beginning 0))
691 (not match-again))) 690 (not match-again)))
692 (if (or (eobp) 691 (if (eobp)
693 (and limit (>= (point) limit)))
694 nil 692 nil
695 ;; Don't replace the null string 693 ;; Don't replace the null string
696 ;; right after end of previous replacement. 694 ;; right after end of previous replacement.
697 (forward-char 1) 695 (forward-char 1)
698 (let ((case-fold-search qr-case-fold-search)) 696 (let ((case-fold-search qr-case-fold-search))