diff options
| author | Stefan Kangas | 2024-12-16 21:46:12 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2024-12-16 21:46:12 +0100 |
| commit | 5c1889c964c99fa3cb0cd91b7703d59bd9fcb495 (patch) | |
| tree | a2760bdfd2b95a720e51c060061fb308129d02c7 | |
| parent | 826b11ddc6c69a06fbed09519b78896085647af0 (diff) | |
| download | emacs-5c1889c964c99fa3cb0cd91b7703d59bd9fcb495.tar.gz 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.
| -rw-r--r-- | lisp/emacs-lisp/map-ynp.el | 37 |
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." | |||
| 135 | mouse-event last-nonmenu-event)) | 135 | mouse-event last-nonmenu-event)) |
| 136 | (setq user-keys (if action-alist | 136 | (setq user-keys (if action-alist |
| 137 | (concat (mapconcat (lambda (elt) | 137 | (concat (mapconcat (lambda (elt) |
| 138 | (key-description | 138 | (substitute-command-keys |
| 139 | (vector (car elt)))) | 139 | (format "\\`%s'" |
| 140 | (key-description | ||
| 141 | (vector (car elt)))))) | ||
| 140 | action-alist ", ") | 142 | action-alist ", ") |
| 141 | " ") | 143 | " ") |
| 142 | "") | 144 | "") |
| @@ -165,10 +167,13 @@ The function's value is the number of actions taken." | |||
| 165 | 'quit)) | 167 | 'quit)) |
| 166 | ;; Prompt in the echo area. | 168 | ;; Prompt in the echo area. |
| 167 | (let ((cursor-in-echo-area (not no-cursor-in-echo-area))) | 169 | (let ((cursor-in-echo-area (not no-cursor-in-echo-area))) |
| 168 | (message (apply 'propertize "%s(y, n, !, ., q, %sor %s) " | 170 | (message (substitute-command-keys |
| 169 | minibuffer-prompt-properties) | 171 | (format |
| 170 | prompt user-keys | 172 | (apply #'propertize |
| 171 | (key-description (vector help-char))) | 173 | "%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') " |
| 174 | minibuffer-prompt-properties) | ||
| 175 | prompt user-keys | ||
| 176 | (key-description (vector help-char))))) | ||
| 172 | (if minibuffer-auto-raise | 177 | (if minibuffer-auto-raise |
| 173 | (raise-frame (window-frame (minibuffer-window)))) | 178 | (raise-frame (window-frame (minibuffer-window)))) |
| 174 | (unwind-protect | 179 | (unwind-protect |
| @@ -184,12 +189,14 @@ The function's value is the number of actions taken." | |||
| 184 | (when (fboundp 'set-text-conversion-style) | 189 | (when (fboundp 'set-text-conversion-style) |
| 185 | (set-text-conversion-style text-conversion-style))) | 190 | (set-text-conversion-style text-conversion-style))) |
| 186 | ;; Show the answer to the question. | 191 | ;; Show the answer to the question. |
| 187 | (message "%s(y, n, !, ., q, %sor %s) %s" | 192 | (message (substitute-command-keys |
| 188 | prompt user-keys | 193 | (format |
| 189 | (key-description (vector help-char)) | 194 | "%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') %s" |
| 190 | (if (equal char -1) | 195 | prompt user-keys |
| 191 | "[end-of-keyboard-macro]" | 196 | (key-description (vector help-char)) |
| 192 | (single-key-description char)))) | 197 | (if (equal char -1) |
| 198 | "[end-of-keyboard-macro]" | ||
| 199 | (single-key-description char)))))) | ||
| 193 | (setq def (lookup-key map (vector char)))) | 200 | (setq def (lookup-key map (vector char)))) |
| 194 | (cond ((eq def 'exit) | 201 | (cond ((eq def 'exit) |
| 195 | (setq next (lambda () nil))) | 202 | (setq next (lambda () nil))) |
| @@ -264,8 +271,10 @@ Type \\`SPC' or \\`y' to %s the current %s; | |||
| 264 | (funcall try-again)) | 271 | (funcall try-again)) |
| 265 | (t | 272 | (t |
| 266 | ;; Random char. | 273 | ;; Random char. |
| 267 | (message "Type %s for help." | 274 | (message (substitute-command-keys |
| 268 | (key-description (vector help-char))) | 275 | (format |
| 276 | "Type \\`%s' for help" | ||
| 277 | (key-description (vector help-char))))) | ||
| 269 | (beep) | 278 | (beep) |
| 270 | (sit-for 1) | 279 | (sit-for 1) |
| 271 | (funcall try-again)))) | 280 | (funcall try-again)))) |