emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110119: * lisp/replace.el (read-rege


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110119: * lisp/replace.el (read-regexp): Add HISTORY arg.
Date: Fri, 21 Sep 2012 00:28:47 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110119
fixes bug: http://debbugs.gnu.org/7567
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Fri 2012-09-21 00:28:47 +0300
message:
  * lisp/replace.el (read-regexp): Add HISTORY arg.
modified:
  lisp/ChangeLog
  lisp/replace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-09-20 21:21:46 +0000
+++ b/lisp/ChangeLog    2012-09-20 21:28:47 +0000
@@ -1,5 +1,7 @@
 2012-09-20  Juri Linkov  <address@hidden>
 
+       * replace.el (read-regexp): Add HISTORY arg.  (Bug#7567)
+
        * replace.el (read-regexp): Don't add ": " when PROMPT already
        ends with a colon and space.  (Bug#12321)
 

=== modified file 'lisp/replace.el'
--- a/lisp/replace.el   2012-09-20 21:21:46 +0000
+++ b/lisp/replace.el   2012-09-20 21:28:47 +0000
@@ -574,14 +574,17 @@
 (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 @@
                                 (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]