aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorGerd Moellmann2000-06-26 20:02:42 +0000
committerGerd Moellmann2000-06-26 20:02:42 +0000
commit889617de079fca1b745df4ec16ea55be67358335 (patch)
tree915e04096ac04d31faa88c6dc1f196f25ae5506e /lisp/replace.el
parent7f3e4303ef76ec1113dc5454fdd491107350371f (diff)
downloademacs-889617de079fca1b745df4ec16ea55be67358335.tar.gz
emacs-889617de079fca1b745df4ec16ea55be67358335.zip
(perform-replace): Undo change of 2000-04-04.
Instead, move backward 1 character At the end of the loop when necessary.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el24
1 files changed, 14 insertions, 10 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index adf56293f51..418c3398e68 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -885,16 +885,13 @@ which will run faster and probably do exactly what you want."
885 (progn (goto-char (nth 1 match-again)) 885 (progn (goto-char (nth 1 match-again))
886 match-again) 886 match-again)
887 (and (or match-again 887 (and (or match-again
888 ;; MATCH-AGAIN nil means in the 888 ;; MATCH-AGAIN non-nil means we
889 ;; regexp case that there's no 889 ;; accept an adjacent match. If
890 ;; match adjacent to the last 890 ;; we don't, move one char to the
891 ;; one. So, we could move 891 ;; right. This takes us a
892 ;; forward, but we don't want to 892 ;; character too far at the end,
893 ;; because that moves point 1 893 ;; but this is undone after the
894 ;; position after the last 894 ;; while-loop.
895 ;; replacement when everything
896 ;; has been done.
897 regexp-flag
898 (progn (forward-char 1) (not (eobp)))) 895 (progn (forward-char 1) (not (eobp))))
899 (funcall search-function search-string limit t) 896 (funcall search-function search-string limit t)
900 ;; For speed, use only integers and 897 ;; For speed, use only integers and
@@ -1048,6 +1045,13 @@ which will run faster and probably do exactly what you want."
1048 (cons (cons (point) 1045 (cons (cons (point)
1049 (or replaced (match-data t))) 1046 (or replaced (match-data t)))
1050 stack))))) 1047 stack)))))
1048
1049 ;; The code preventing adjacent regexp matches in the condition
1050 ;; of the while-loop above will haven taken us one character
1051 ;; beyond the last replacement. Undo that.
1052 (when (and regexp-flag (not match-again) (> replace-count 0))
1053 (backward-char 1))
1054
1051 (replace-dehighlight)) 1055 (replace-dehighlight))
1052 (or unread-command-events 1056 (or unread-command-events
1053 (message "Replaced %d occurrence%s" 1057 (message "Replaced %d occurrence%s"