Make format-prompt' use
substitute-command-keys'
* doc/lispref/minibuf.texi (Text from Minibuffer): Mention it. * lisp/minibuffer.el (format-prompt): Run through `substitute-command-keys' (bug#51040).
This commit is contained in:
parent
0fd24ebc95
commit
3062baf609
3 changed files with 16 additions and 3 deletions
|
@ -490,6 +490,9 @@ If @var{default} is @code{nil}, there is no default value, and
|
|||
therefore no ``default value'' string is included in the result value.
|
||||
If @var{default} is a non-@code{nil} list, the first element of the
|
||||
list is used in the prompt.
|
||||
|
||||
Both @var{prompt} and @code{minibuffer-default-prompt-format} are run
|
||||
through @code{substitute-command-keys} (@pxref{Keys in Documentation}).
|
||||
@end defun
|
||||
|
||||
@defvar read-minibuffer-restore-windows
|
||||
|
|
5
etc/NEWS
5
etc/NEWS
|
@ -2450,6 +2450,11 @@ when visiting JSON files.
|
|||
|
||||
* Incompatible Lisp Changes in Emacs 29.1
|
||||
|
||||
+++
|
||||
** 'format-prompt' now uses 'substitute-command-keys'.
|
||||
This means that both the prompt and 'minibuffer-default-prompt-format'
|
||||
will have key definitions and single quotes handled specially.
|
||||
|
||||
---
|
||||
** 'find-image' now uses 'create-image'.
|
||||
This means that images found through 'find-image' also have
|
||||
|
|
|
@ -4461,6 +4461,11 @@ FORMAT-ARGS is non-nil, PROMPT is used as a format control
|
|||
string, and FORMAT-ARGS are the arguments to be substituted into
|
||||
it. See `format' for details.
|
||||
|
||||
Both PROMTP and `minibuffer-default-prompt-format' are run
|
||||
through `substitute-command-keys' (which see). In particular,
|
||||
this means that single quotes may be adjusted for the current
|
||||
terminal.
|
||||
|
||||
If DEFAULT is a list, the first element is used as the default.
|
||||
If not, the element is used as is.
|
||||
|
||||
|
@ -4468,12 +4473,12 @@ If DEFAULT is nil or an empty string, no \"default value\" string
|
|||
is included in the return value."
|
||||
(concat
|
||||
(if (null format-args)
|
||||
prompt
|
||||
(apply #'format prompt format-args))
|
||||
(substitute-command-keys prompt)
|
||||
(apply #'format (substitute-command-keys prompt) format-args))
|
||||
(and default
|
||||
(or (not (stringp default))
|
||||
(length> default 0))
|
||||
(format minibuffer-default-prompt-format
|
||||
(format (substitute-command-keys minibuffer-default-prompt-format)
|
||||
(if (consp default)
|
||||
(car default)
|
||||
default)))
|
||||
|
|
Loading…
Add table
Reference in a new issue