diff options
| author | Juri Linkov | 2012-09-21 00:21:46 +0300 |
|---|---|---|
| committer | Juri Linkov | 2012-09-21 00:21:46 +0300 |
| commit | 41a97e6fcf1cd4614a9dcd13ee843a922f3890b4 (patch) | |
| tree | 6a385efb33c7d182d7bd1cf0e18dc1706290f44d /lisp/replace.el | |
| parent | c9e452d3a1e611ccd66a0c0030ef8e12d73b27c9 (diff) | |
| download | emacs-41a97e6fcf1cd4614a9dcd13ee843a922f3890b4.tar.gz emacs-41a97e6fcf1cd4614a9dcd13ee843a922f3890b4.zip | |
* lisp/replace.el (read-regexp): Don't add ": " when PROMPT already
ends with a colon and space.
Fixes: debbugs:12321
Diffstat (limited to 'lisp/replace.el')
| -rw-r--r-- | lisp/replace.el | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 001f7d1a78d..2f5a9cb6bf6 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -576,10 +576,10 @@ of `history-length', which see.") | |||
| 576 | 576 | ||
| 577 | (defun read-regexp (prompt &optional default-value) | 577 | (defun read-regexp (prompt &optional default-value) |
| 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. |
| 579 | Prompt for a regular expression with PROMPT (without a colon and | 579 | When PROMPT doesn't end with a colon and space, it adds a final \": \". |
| 580 | space) in the minibuffer. The optional argument DEFAULT-VALUE | 580 | If DEFAULT-VALUE is non-nil, it displays the first default in the prompt. |
| 581 | provides the value to display in the minibuffer prompt that is | 581 | The optional argument DEFAULT-VALUE provides the value to display |
| 582 | returned if the user just types RET. | 582 | in the minibuffer prompt that is returned if the user just types RET. |
| 583 | Values available via M-n are the string at point, the last isearch | 583 | Values available via M-n are the string at point, the last isearch |
| 584 | regexp, the last isearch string, and the last replacement regexp." | 584 | regexp, the last isearch string, and the last replacement regexp." |
| 585 | (let* ((defaults | 585 | (let* ((defaults |
| @@ -595,13 +595,15 @@ regexp, the last isearch string, and the last replacement regexp." | |||
| 595 | (defaults (delete-dups (delq nil (delete "" defaults)))) | 595 | (defaults (delete-dups (delq nil (delete "" defaults)))) |
| 596 | ;; Don't add automatically the car of defaults for empty input | 596 | ;; Don't add automatically the car of defaults for empty input |
| 597 | (history-add-new-input nil) | 597 | (history-add-new-input nil) |
| 598 | (input | 598 | (input (read-from-minibuffer |
| 599 | (read-from-minibuffer | 599 | (cond ((string-match-p ":[ \t]*\\'" prompt) |
| 600 | (if default-value | 600 | prompt) |
| 601 | (format "%s (default %s): " prompt | 601 | (default-value |
| 602 | (query-replace-descr default-value)) | 602 | (format "%s (default %s): " prompt |
| 603 | (format "%s: " prompt)) | 603 | (query-replace-descr default-value))) |
| 604 | nil nil nil 'regexp-history defaults t))) | 604 | (t |
| 605 | (format "%s: " prompt))) | ||
| 606 | nil nil nil 'regexp-history defaults t))) | ||
| 605 | (if (equal input "") | 607 | (if (equal input "") |
| 606 | (or default-value input) | 608 | (or default-value input) |
| 607 | (prog1 input | 609 | (prog1 input |