]> git.eshelyaron.com Git - emacs.git/commitdiff
(perform-replace): Don't move forward one char
authorGerd Moellmann <gerd@gnu.org>
Tue, 4 Apr 2000 21:01:53 +0000 (21:01 +0000)
committerGerd Moellmann <gerd@gnu.org>
Tue, 4 Apr 2000 21:01:53 +0000 (21:01 +0000)
when MATCH-AGAIN is nil, and REGEXP-FLAG is t.  We don't want
to do that because it leaves point 1 position after the last
replacement, after everything has been replaced.

lisp/replace.el

index 5ff9645aac65597e636a4b8fdcf31d36e8bd7865..51005ea2fbed549307322b0948fa975f5948bdf6 100644 (file)
@@ -1,6 +1,7 @@
 ;;; replace.el --- replace commands for Emacs.
 
-;; Copyright (C) 1985, 86, 87, 92, 94, 96, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 86, 87, 92, 94, 96, 1997, 2000
+;;  Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -862,9 +863,17 @@ which will run faster and probably do exactly what you want."
                              (progn (goto-char (nth 1 match-again))
                                     match-again)
                            (and (or match-again
-                                    (progn
-                                      (forward-char 1)
-                                      (not (eobp))))
+                                    ;; 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
+                                    (progn (forward-char 1) (not (eobp))))
                                 (funcall search-function search-string limit t)
                                 ;; For speed, use only integers and
                                 ;; reuse the list used last time.