comparison 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
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
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))
682 (let ((case-fold-search qr-case-fold-search)) 683 (let ((case-fold-search qr-case-fold-search))
683 (funcall search-function search-string limit)) 684 (funcall search-function search-string limit))
684 ;; If the search string matches immediately after 685 ;; If the search string matches immediately after
685 ;; the previous match, but it did not match there 686 ;; the previous match, but it did not match there
686 ;; before the replacement was done, ignore the match. 687 ;; before the replacement was done, ignore the match.
687 (if (or (eq lastrepl (point)) 688 (if (or (eq lastrepl (point))
688 (and regexp-flag 689 (and regexp-flag
689 (eq lastrepl (match-beginning 0)) 690 (eq lastrepl (match-beginning 0))
690 (not match-again))) 691 (not match-again)))
691 (if (eobp) 692 (if (or (eobp)
693 (and limit (>= (point) limit)))
692 nil 694 nil
693 ;; Don't replace the null string 695 ;; Don't replace the null string
694 ;; right after end of previous replacement. 696 ;; right after end of previous replacement.
695 (forward-char 1) 697 (forward-char 1)
696 (let ((case-fold-search qr-case-fold-search)) 698 (let ((case-fold-search qr-case-fold-search))