Mercurial > emacs
changeset 29952:3e2589e69a8a
(perform-replace): Undo change of 2000-04-04.
Instead, move backward 1 character At the end of the loop when
necessary.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 26 Jun 2000 20:02:42 +0000 |
parents | afb99b8ba100 |
children | dad7b11391a3 |
files | lisp/replace.el |
diffstat | 1 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/replace.el Mon Jun 26 16:00:26 2000 +0000 +++ b/lisp/replace.el Mon Jun 26 20:02:42 2000 +0000 @@ -885,16 +885,13 @@ (progn (goto-char (nth 1 match-again)) match-again) (and (or match-again - ;; MATCH-AGAIN nil means in the - ;; regexp case that there's no - ;; match adjacent to the last - ;; one. So, we could move - ;; forward, but we don't want to - ;; because that moves point 1 - ;; position after the last - ;; replacement when everything - ;; has been done. - regexp-flag + ;; MATCH-AGAIN non-nil means we + ;; accept an adjacent match. If + ;; we don't, move one char to the + ;; right. This takes us a + ;; character too far at the end, + ;; but this is undone after the + ;; while-loop. (progn (forward-char 1) (not (eobp)))) (funcall search-function search-string limit t) ;; For speed, use only integers and @@ -1048,6 +1045,13 @@ (cons (cons (point) (or replaced (match-data t))) stack))))) + + ;; The code preventing adjacent regexp matches in the condition + ;; of the while-loop above will haven taken us one character + ;; beyond the last replacement. Undo that. + (when (and regexp-flag (not match-again) (> replace-count 0)) + (backward-char 1)) + (replace-dehighlight)) (or unread-command-events (message "Replaced %d occurrence%s"