diff lisp/replace.el @ 83256:389421e988c2

Merged from miles@gnu.org--gnu-2005 (patch 17-26, 107-116) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-107 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-108 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-109 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-110 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-112 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-113 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-114 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-115 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-116 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-17 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-18 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-19 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-20 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-21 More work on moving images to etc/images * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-22 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-23 Fix errors with image-file installation * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-24 etc/Makefile.in (install): Put gnus-tut.txt in the right place. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-25 etc/Makefile.in (install, uninstall): Fix installed image dirs. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-26 etc/Makefile.in (install): Create $(etcdir)/images/gnus dir. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-296
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 20 Feb 2005 18:47:54 +0000
parents 85f04f438e03
children 4d79094ee455 bf0d492ea2d5
line wrap: on
line diff
--- a/lisp/replace.el	Sat Feb 19 00:06:48 2005 +0000
+++ b/lisp/replace.el	Sun Feb 20 18:47:54 2005 +0000
@@ -115,8 +115,11 @@
 	       query-replace-from-history-variable
 	       nil t t))))
       (if (and (zerop (length from)) lastto lastfrom)
-	  (cons lastfrom
-		(query-replace-compile-replacement lastto regexp-flag))
+	  (progn
+	    (cons lastfrom
+		  (query-replace-compile-replacement lastto regexp-flag))
+	    (set query-replace-from-history-variable
+		 (cdr (symbol-value query-replace-from-history-variable))))
 	;; Warn if user types \n or \t, but don't reject the input.
 	(and regexp-flag
 	     (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from)
@@ -214,7 +217,11 @@
 
 To customize possible responses, change the \"bindings\" in `query-replace-map'."
   (interactive (let ((common
-		      (query-replace-read-args "Query replace" nil)))
+		      (query-replace-read-args 
+		       (if (and transient-mark-mode mark-active)
+			 "Query replace in region"
+			 "Query replace")
+			 nil)))
 		 (list (nth 0 common) (nth 1 common) (nth 2 common)
 		       ;; These are done separately here
 		       ;; so that command-history will record these expressions
@@ -274,7 +281,11 @@
 Use \\[repeat-complex-command] after this command for details."
   (interactive
    (let ((common
-	  (query-replace-read-args "Query replace regexp" t)))
+	  (query-replace-read-args 
+	   (if (and transient-mark-mode mark-active)
+	       "Query replace regexp in region"
+	     "Query replace regexp")
+	   t)))
      (list (nth 0 common) (nth 1 common) (nth 2 common)
 	   ;; These are done separately here
 	   ;; so that command-history will record these expressions
@@ -420,7 +431,11 @@
 and TO-STRING is also null.)"
   (interactive
    (let ((common
-	  (query-replace-read-args "Replace string" nil)))
+	  (query-replace-read-args 
+	   (if (and transient-mark-mode mark-active)
+	       "Replace string in region"
+	     "Replace string")
+	   nil)))
      (list (nth 0 common) (nth 1 common) (nth 2 common)
 	   (if (and transient-mark-mode mark-active)
 	       (region-beginning))
@@ -474,7 +489,11 @@
 which will run faster and will not set the mark or print anything."
   (interactive
    (let ((common
-	  (query-replace-read-args "Replace regexp" t)))
+	  (query-replace-read-args 
+	   (if (and transient-mark-mode mark-active)
+	       "Replace regexp in region" 
+	     "Replace regexp") 
+	   t)))
      (list (nth 0 common) (nth 1 common) (nth 2 common)
 	   (if (and transient-mark-mode mark-active)
 	       (region-beginning))