aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorRichard M. Stallman1998-01-30 23:34:50 +0000
committerRichard M. Stallman1998-01-30 23:34:50 +0000
commitbdb1c08fb956fe149cfdf609f7f152c2ec152992 (patch)
tree299bb541048f4a1b5bde3c54992802d459872f8a /lisp/replace.el
parent7977773d3fa03d439eb931013656f6114cb21ac4 (diff)
downloademacs-bdb1c08fb956fe149cfdf609f7f152c2ec152992.tar.gz
emacs-bdb1c08fb956fe149cfdf609f7f152c2ec152992.zip
(query-replace-from-history-variable): New variable.
(query-replace-to-history-variable): New variable. (query-replace-read-args): Use them.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el21
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index b38a8165720..0542b8df371 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -37,16 +37,33 @@
37 "Non-nil means `query-replace' uses the last search string. 37 "Non-nil means `query-replace' uses the last search string.
38That becomes the \"string to replace\".") 38That becomes the \"string to replace\".")
39 39
40(defcustom query-replace-from-history-variable 'query-replace-history
41 "History list to use for the FROM argument of query-replace commands.
42The value of this variable should be a symbol; that symbol
43is used as a variable to hold a history list for the strings
44or patterns to be replaced."
45 :group 'matching
46 :type 'symbol)
47
48(defcustom query-replace-to-history-variable 'query-replace-history
49 "History list to use for the TO argument of query-replace commands.
50The value of this variable should be a symbol; that symbol
51is used as a variable to hold a history list for replacement
52strings or patterns."
53 :group 'matching
54 :type 'symbol)
55
40(defun query-replace-read-args (string regexp-flag) 56(defun query-replace-read-args (string regexp-flag)
41 (let (from to) 57 (let (from to)
42 (if query-replace-interactive 58 (if query-replace-interactive
43 (setq from (car (if regexp-flag regexp-search-ring search-ring))) 59 (setq from (car (if regexp-flag regexp-search-ring search-ring)))
44 (setq from (read-from-minibuffer (format "%s: " string) 60 (setq from (read-from-minibuffer (format "%s: " string)
45 nil nil nil 61 nil nil nil
46 'query-replace-history nil t))) 62 query-replace-from-history-variable
63 nil t)))
47 (setq to (read-from-minibuffer (format "%s %s with: " string from) 64 (setq to (read-from-minibuffer (format "%s %s with: " string from)
48 nil nil nil 65 nil nil nil
49 'query-replace-history nil t)) 66 query-replace-to-history-variable nil t))
50 (list from to current-prefix-arg))) 67 (list from to current-prefix-arg)))
51 68
52(defun query-replace (from-string to-string &optional arg) 69(defun query-replace (from-string to-string &optional arg)