emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110118: * lisp/replace.el (read-regexp): Don't add ": " when PROMPT already
Date: Fri, 21 Sep 2012 00:21:46 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110118
fixes bug: http://debbugs.gnu.org/12321
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Fri 2012-09-21 00:21:46 +0300
message:
  * lisp/replace.el (read-regexp): Don't add ": " when PROMPT already
  ends with a colon and space.
modified:
  lisp/ChangeLog
  lisp/replace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-09-20 19:53:40 +0000
+++ b/lisp/ChangeLog    2012-09-20 21:21:46 +0000
@@ -1,3 +1,8 @@
+2012-09-20  Juri Linkov  <address@hidden>
+
+       * replace.el (read-regexp): Don't add ": " when PROMPT already
+       ends with a colon and space.  (Bug#12321)
+
 2012-09-20  Tassilo Horn  <address@hidden>
 
        * doc-view.el (doc-view-display): Better fix for the cl-assertion

=== modified file 'lisp/replace.el'
--- a/lisp/replace.el   2012-09-09 22:15:24 +0000
+++ b/lisp/replace.el   2012-09-20 21:21:46 +0000
@@ -576,10 +576,10 @@
 
 (defun read-regexp (prompt &optional default-value)
   "Read regexp as a string using the regexp history and some useful defaults.
-Prompt for a regular expression with PROMPT (without a colon and
-space) in the minibuffer.  The optional argument DEFAULT-VALUE
-provides the value to display in the minibuffer prompt that is
-returned if the user just types RET.
+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."
   (let* ((defaults
@@ -595,13 +595,15 @@
         (defaults (delete-dups (delq nil (delete "" defaults))))
         ;; Don't add automatically the car of defaults for empty input
         (history-add-new-input nil)
-        (input
-         (read-from-minibuffer
-          (if default-value
-              (format "%s (default %s): " prompt
-                      (query-replace-descr default-value))
-            (format "%s: " prompt))
-          nil nil nil 'regexp-history defaults t)))
+        (input (read-from-minibuffer
+                (cond ((string-match-p ":[ \t]*\\'" prompt)
+                       prompt)
+                      (default-value
+                        (format "%s (default %s): " prompt
+                                (query-replace-descr default-value)))
+                      (t
+                       (format "%s: " prompt)))
+                nil nil nil 'regexp-history defaults t)))
     (if (equal input "")
        (or default-value input)
       (prog1 input


reply via email to

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