diff options
author | Juri Linkov <juri@jurta.org> | 2012-09-21 00:28:47 +0300 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2012-09-21 00:28:47 +0300 |
commit | eebbf404b840534736d5ccb4d65602fee0a5cc5d (patch) | |
tree | 5042d9865230b7cc57c1743683d91b9550200778 /lisp/replace.el | |
parent | 41a97e6fcf1cd4614a9dcd13ee843a922f3890b4 (diff) | |
download | emacs-eebbf404b840534736d5ccb4d65602fee0a5cc5d.tar.gz |
* lisp/replace.el (read-regexp): Add HISTORY arg.
Fixes: debbugs:7567
Diffstat (limited to 'lisp/replace.el')
-rw-r--r-- | lisp/replace.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 2f5a9cb6bf6..70819ea255b 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -574,14 +574,17 @@ of `history-length', which see.") (defvar occur-collect-regexp-history '("\\1") "History of regexp for occur's collect operation") -(defun read-regexp (prompt &optional default-value) +(defun read-regexp (prompt &optional default-value history) "Read regexp as a string using the regexp history and some useful defaults. When PROMPT doesn't end with a colon and space, it adds a final \": \". If DEFAULT-VALUE is non-nil, it displays the first default in the prompt. The optional argument DEFAULT-VALUE provides the value to display in the minibuffer prompt that is returned if the user just types RET. Values available via M-n are the string at point, the last isearch -regexp, the last isearch string, and the last replacement regexp." +regexp, the last isearch string, and the last replacement regexp. + +Non-nil HISTORY is a symbol to use for the history list. +If HISTORY is nil, `regexp-history' is used." (let* ((defaults (list (regexp-quote (or (funcall (or find-tag-default-function @@ -603,11 +606,11 @@ regexp, the last isearch string, and the last replacement regexp." (query-replace-descr default-value))) (t (format "%s: " prompt))) - nil nil nil 'regexp-history defaults t))) + nil nil nil (or history 'regexp-history) defaults t))) (if (equal input "") (or default-value input) (prog1 input - (add-to-history 'regexp-history input))))) + (add-to-history (or history 'regexp-history) input))))) (defalias 'delete-non-matching-lines 'keep-lines) |