[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3062baf609: Make `format-prompt' use `substitute-command-keys'
From: |
Lars Ingebrigtsen |
Subject: |
master 3062baf609: Make `format-prompt' use `substitute-command-keys' |
Date: |
Sat, 10 Sep 2022 02:13:53 -0400 (EDT) |
branch: master
commit 3062baf609baf49ea3742f224d522ca8d793cdb5
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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).
---
doc/lispref/minibuf.texi | 3 +++
etc/NEWS | 5 +++++
lisp/minibuffer.el | 11 ++++++++---
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index f2adc01c8f..089ae41f32 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index ba2f57772c..2f52e9bc37 100644
--- a/etc/NEWS
+++ b/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
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 3daab8a1e8..9dbada87cb 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -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)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 3062baf609: Make `format-prompt' use `substitute-command-keys',
Lars Ingebrigtsen <=