diff lisp/replace.el @ 28502:3e4e6d45a774

(perform-replace): Don't move forward one char 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.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 04 Apr 2000 21:01:53 +0000
parents abaa4ac29f51
children 29790e97da09
line wrap: on
line diff
--- a/lisp/replace.el	Tue Apr 04 21:00:36 2000 +0000
+++ b/lisp/replace.el	Tue Apr 04 21:01:53 2000 +0000
@@ -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 @@
 			      (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.