summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/map-ynp.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/map-ynp.el')
-rw-r--r--lisp/emacs-lisp/map-ynp.el44
1 files changed, 29 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index 5b9ffe3a03d..952497032a2 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
@@ -180,16 +185,23 @@ The function's value is the number of actions taken."
(let ((overriding-text-conversion-style nil))
(when (fboundp 'set-text-conversion-style)
(set-text-conversion-style text-conversion-style))
- (setq char (read-event)))
+ ;; Do NOT use read-event here. That
+ ;; function does not consult
+ ;; input-decode-map (bug#75886).
+ (setq char (read-key))
+ (when (eq char ?\C-g)
+ (signal 'quit nil)))
(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 +276,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))))