|
From: | Stefan Monnier |
Subject: | bug#12443: 24.2.50; Default values in the minibuffer prompt (fix inconsisntecy) |
Date: | Tue, 25 Aug 2020 09:45:50 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>>> (defcustom minibuffer-default-prompt-format " (default %s)" >>> "Default format." >>> :type 'string) >>> >>> Example of usage: >>> >>> (let ((default "def")) >>> (read-from-minibuffer >>> (format "Set bookmark%s: " >>> (format minibuffer-default-prompt-format default)))) Nitpick: `read-from-minibuffer` is a low-level function which you should never use directly but only within other `read-<foo>` functions. E.g. here one should probably use `read-string` instead. Please make sure that `minibuffer-electric-default-mode` pays attention to it. > 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: " LGTM, Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |