summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2024-12-16 21:46:12 +0100
committerStefan Kangas <stefankangas@gmail.com>2024-12-16 21:46:12 +0100
commit5c1889c964c99fa3cb0cd91b7703d59bd9fcb495 (patch)
treea2760bdfd2b95a720e51c060061fb308129d02c7 /lisp/emacs-lisp
parent826b11ddc6c69a06fbed09519b78896085647af0 (diff)
downloademacs-5c1889c964c99fa3cb0cd91b7703d59bd9fcb495.tar.gz
emacs-5c1889c964c99fa3cb0cd91b7703d59bd9fcb495.tar.bz2
emacs-5c1889c964c99fa3cb0cd91b7703d59bd9fcb495.zip
Use substitute-command-keys in map-y-or-n-p
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Use substitute-command-keys.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/map-ynp.el37
1 files changed, 23 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index 7b135c54a15..8ba88972a89 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -135,8 +135,10 @@ The function's value is the number of actions taken."
mouse-event last-nonmenu-event))
(setq user-keys (if action-alist
(concat (mapconcat (lambda (elt)
- (key-description
- (vector (car elt))))
+ (substitute-command-keys
+ (format "\\`%s'"
+ (key-description
+ (vector (car elt))))))
action-alist ", ")
" ")
"")
@@ -165,10 +167,13 @@ The function's value is the number of actions taken."
'quit))
;; Prompt in the echo area.
(let ((cursor-in-echo-area (not no-cursor-in-echo-area)))
- (message (apply 'propertize "%s(y, n, !, ., q, %sor %s) "
- minibuffer-prompt-properties)
- prompt user-keys
- (key-description (vector help-char)))
+ (message (substitute-command-keys
+ (format
+ (apply #'propertize
+ "%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') "
+ minibuffer-prompt-properties)
+ prompt user-keys
+ (key-description (vector help-char)))))
(if minibuffer-auto-raise
(raise-frame (window-frame (minibuffer-window))))
(unwind-protect
@@ -184,12 +189,14 @@ The function's value is the number of actions taken."
(when (fboundp 'set-text-conversion-style)
(set-text-conversion-style text-conversion-style)))
;; Show the answer to the question.
- (message "%s(y, n, !, ., q, %sor %s) %s"
- prompt user-keys
- (key-description (vector help-char))
- (if (equal char -1)
- "[end-of-keyboard-macro]"
- (single-key-description char))))
+ (message (substitute-command-keys
+ (format
+ "%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') %s"
+ prompt user-keys
+ (key-description (vector help-char))
+ (if (equal char -1)
+ "[end-of-keyboard-macro]"
+ (single-key-description char))))))
(setq def (lookup-key map (vector char))))
(cond ((eq def 'exit)
(setq next (lambda () nil)))
@@ -264,8 +271,10 @@ Type \\`SPC' or \\`y' to %s the current %s;
(funcall try-again))
(t
;; Random char.
- (message "Type %s for help."
- (key-description (vector help-char)))
+ (message (substitute-command-keys
+ (format
+ "Type \\`%s' for help"
+ (key-description (vector help-char)))))
(beep)
(sit-for 1)
(funcall try-again))))