GNU bug report logs -
#12443
24.2.50; Default values in the minibuffer prompt (fix
Previous Next
Reported by: Dani Moncayo <dmoncayo <at> gmail.com>
Date: Fri, 14 Sep 2012 14:08:01 UTC
Severity: minor
Found in version 24.2.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #46 received at 12443 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefankangas <at> gmail.com> writes:
> How about taking it even further? Something along the lines of:
>
> (format-prompt PROMPT &optional DEFAULT)
>
> (format-prompt "Set bookmark" default)
> => "Set bookmark [foobar]: "
>
> (format-prompt "Goto char")
> => "Goto char: "
>
> (This would avoid having to always remember to use double formats like
> above.)
I like it. I just grepped for '(default %' just to see how this would
look in practice. Most of them look good:
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 873d586ca1..5335855d6e 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -339,8 +339,7 @@ dired--mark-suffix-interactive-spec
('(16)
(let* ((dflt (char-to-string dired-marker-char))
(input (read-string
- (format
- "Marker character to use (default %s): " dflt)
+ (format-prompt "Marker character to use" dflt)
nil nil dflt)))
(aref input 0)))
(_ dired-marker-char))))
diff --git a/lisp/frame.el b/lisp/frame.el
index 081d3010e9..d9e49d50ba 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -760,7 +760,7 @@ close-display-connection
(list
(let* ((default (frame-parameter nil 'display))
(display (completing-read
- (format "Close display (default %s): " default)
+ (format-prompt "Close display" default)
(delete-dups
(mapcar (lambda (frame)
(frame-parameter frame 'display))
However, there's things like:
(setq from-coding (read-coding-system
(format "Recode filename %s from (default %s): "
filename default-coding)
default-coding))
These are surprisingly rare, but, uhm... perhaps format-prompt could
take a format string? The function would then look like:
(defun format-prompt (prompt default &rest format-args)
)
where it would call `format' on PROMPT and FORMAT-ARGS.
So that would then be:
(setq from-coding (read-coding-system
(format-prompt "Recode filename %s"
default-coding filename)
default-coding))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 124 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.