aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorJuri Linkov2012-09-21 00:28:47 +0300
committerJuri Linkov2012-09-21 00:28:47 +0300
commiteebbf404b840534736d5ccb4d65602fee0a5cc5d (patch)
tree5042d9865230b7cc57c1743683d91b9550200778 /lisp/replace.el
parent41a97e6fcf1cd4614a9dcd13ee843a922f3890b4 (diff)
downloademacs-eebbf404b840534736d5ccb4d65602fee0a5cc5d.tar.gz
emacs-eebbf404b840534736d5ccb4d65602fee0a5cc5d.zip
* lisp/replace.el (read-regexp): Add HISTORY arg.
Fixes: debbugs:7567
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el11
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.")
574(defvar occur-collect-regexp-history '("\\1") 574(defvar occur-collect-regexp-history '("\\1")
575 "History of regexp for occur's collect operation") 575 "History of regexp for occur's collect operation")
576 576
577(defun read-regexp (prompt &optional default-value) 577(defun read-regexp (prompt &optional default-value history)
578 "Read regexp as a string using the regexp history and some useful defaults. 578 "Read regexp as a string using the regexp history and some useful defaults.
579When PROMPT doesn't end with a colon and space, it adds a final \": \". 579When PROMPT doesn't end with a colon and space, it adds a final \": \".
580If DEFAULT-VALUE is non-nil, it displays the first default in the prompt. 580If DEFAULT-VALUE is non-nil, it displays the first default in the prompt.
581The optional argument DEFAULT-VALUE provides the value to display 581The optional argument DEFAULT-VALUE provides the value to display
582in the minibuffer prompt that is returned if the user just types RET. 582in the minibuffer prompt that is returned if the user just types RET.
583Values available via M-n are the string at point, the last isearch 583Values available via M-n are the string at point, the last isearch
584regexp, the last isearch string, and the last replacement regexp." 584regexp, the last isearch string, and the last replacement regexp.
585
586Non-nil HISTORY is a symbol to use for the history list.
587If HISTORY is nil, `regexp-history' is used."
585 (let* ((defaults 588 (let* ((defaults
586 (list (regexp-quote 589 (list (regexp-quote
587 (or (funcall (or find-tag-default-function 590 (or (funcall (or find-tag-default-function
@@ -603,11 +606,11 @@ regexp, the last isearch string, and the last replacement regexp."
603 (query-replace-descr default-value))) 606 (query-replace-descr default-value)))
604 (t 607 (t
605 (format "%s: " prompt))) 608 (format "%s: " prompt)))
606 nil nil nil 'regexp-history defaults t))) 609 nil nil nil (or history 'regexp-history) defaults t)))
607 (if (equal input "") 610 (if (equal input "")
608 (or default-value input) 611 (or default-value input)
609 (prog1 input 612 (prog1 input
610 (add-to-history 'regexp-history input))))) 613 (add-to-history (or history 'regexp-history) input)))))
611 614
612 615
613(defalias 'delete-non-matching-lines 'keep-lines) 616(defalias 'delete-non-matching-lines 'keep-lines)