1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

(query-replace-from-history-variable): New variable.

(query-replace-to-history-variable): New variable.
(query-replace-read-args): Use them.
This commit is contained in:
Richard M. Stallman 1998-01-30 23:34:50 +00:00
parent 7977773d3f
commit bdb1c08fb9

View File

@ -37,16 +37,33 @@
"Non-nil means `query-replace' uses the last search string. "Non-nil means `query-replace' uses the last search string.
That becomes the \"string to replace\".") That becomes the \"string to replace\".")
(defcustom query-replace-from-history-variable 'query-replace-history
"History list to use for the FROM argument of query-replace commands.
The value of this variable should be a symbol; that symbol
is used as a variable to hold a history list for the strings
or patterns to be replaced."
:group 'matching
:type 'symbol)
(defcustom query-replace-to-history-variable 'query-replace-history
"History list to use for the TO argument of query-replace commands.
The value of this variable should be a symbol; that symbol
is used as a variable to hold a history list for replacement
strings or patterns."
:group 'matching
:type 'symbol)
(defun query-replace-read-args (string regexp-flag) (defun query-replace-read-args (string regexp-flag)
(let (from to) (let (from to)
(if query-replace-interactive (if query-replace-interactive
(setq from (car (if regexp-flag regexp-search-ring search-ring))) (setq from (car (if regexp-flag regexp-search-ring search-ring)))
(setq from (read-from-minibuffer (format "%s: " string) (setq from (read-from-minibuffer (format "%s: " string)
nil nil nil nil nil nil
'query-replace-history nil t))) query-replace-from-history-variable
nil t)))
(setq to (read-from-minibuffer (format "%s %s with: " string from) (setq to (read-from-minibuffer (format "%s %s with: " string from)
nil nil nil nil nil nil
'query-replace-history nil t)) query-replace-to-history-variable nil t))
(list from to current-prefix-arg))) (list from to current-prefix-arg)))
(defun query-replace (from-string to-string &optional arg) (defun query-replace (from-string to-string &optional arg)