From 2511035dc74e5637fb020eefdb193f3dd3e810b8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 19 Feb 2005 13:12:21 +0000 Subject: (query-replace-read-from): Set the value of query-replace-from-history-variable to handle the case of an empty string entered to accept the suggested default. --- lisp/replace.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lisp/replace.el') diff --git a/lisp/replace.el b/lisp/replace.el index de3577913c1..eb9f592f01d 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -115,8 +115,11 @@ wants to replace FROM with TO." 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) -- cgit v1.2.1 From f79bdb3aa2f26d28e775af39417981c6dcb0484c Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Sat, 19 Feb 2005 21:08:43 +0000 Subject: (query-replace, query-replace-regexp) (replace-string, replace-regexp): When operating on region, make the minibuffer prompt say so. --- lisp/replace.el | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'lisp/replace.el') diff --git a/lisp/replace.el b/lisp/replace.el index eb9f592f01d..2c60cd006f1 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -217,7 +217,11 @@ Fourth and fifth arg START and END specify the region to operate on. 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 @@ -277,7 +281,11 @@ text, TO-STRING is actually made a list instead of a string. 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 @@ -423,7 +431,11 @@ which will run faster and will not set the mark or print anything. 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)) @@ -477,7 +489,11 @@ What you probably want is a loop like this: 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)) -- cgit v1.2.1