[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12321: 24.2.50; `read-regexp' parameter PROMPT
From: |
Juri Linkov |
Subject: |
bug#12321: 24.2.50; `read-regexp' parameter PROMPT |
Date: |
Thu, 20 Sep 2012 11:18:10 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) |
> First, there is the business of automatically handling `: ' for the
> PROMPT. I thought we had finally gotten away from this kind of thing.
> It just gives callers less control.
There are three contradicting requirements:
1. Maintain backward-compatibility for the PROMPT arg
in all existing calls to `read-regexp'.
2. Do not append automatically ": " to the end of PROMPT.
As bug#7567 demonstrates, more control for callers is necessary
to be able to use `read-regexp' in such specific contexts
as in `query-replace-read-from' that constructs prompt
according to the special format "%s (default %s -> %s): ".
3. The code should not be so "clever" in supporting
two these options above at the same time, as you said in
http://thread.gmane.org/gmane.emacs.devel/134852/focus=134854
But from these three options I see no better thing to do than
to allow `read-regexp' to be "clever" (like `read-buffer'):
=== modified file 'lisp/replace.el'
--- lisp/replace.el 2012-09-09 22:15:24 +0000
+++ lisp/replace.el 2012-09-20 08:15:20 +0000
@@ -597,10 +597,12 @@ (defun read-regexp (prompt &optional def
(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))
+ (if (string-match-p ":[ \t]*\\'" prompt)
+ prompt
+ (if default-value
+ (format "%s (default %s): " prompt
+ (query-replace-descr default-value))
+ (format "%s: " prompt)))
nil nil nil 'regexp-history defaults t)))
(if (equal input "")
(or default-value input)
- bug#12321: 24.2.50; `read-regexp' parameter PROMPT,
Juri Linkov <=