Use 'help-key' function in more places

* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/helper.el (Helper-help-map):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Use 'help-key'.
* lisp/net/tramp-cmds.el (tramp-rename-files):
* lisp/which-key.el (which-key--next-page-hint): Prefer 'help-key'
when available.
* lisp/help.el (help-key): Simplify.
* etc/symbol-releases.eld: Add 'help-key'.
This commit is contained in:
Stefan Kangas 2025-03-17 18:45:20 +01:00
parent 49e019fbbc
commit 69210eb84e
7 changed files with 11 additions and 8 deletions

View file

@ -10,6 +10,7 @@
( (
("29.1" fun plistp) ("29.1" fun plistp)
("29.1" fun help-key)
("28.1" fun always) ("28.1" fun always)
("27.1" fun project-files) ("27.1" fun project-files)
("26.1" fun flymake--diag-region) ("26.1" fun flymake--diag-region)

View file

@ -1912,7 +1912,7 @@ return t; if SYM is q or ESC, return nil."
(concat (apply #'format-message prompt args) (concat (apply #'format-message prompt args)
(if help-form (if help-form
(format " [Type yn!q or %s] " (format " [Type yn!q or %s] "
(key-description (vector help-char))) (help-key))
" [Type y, n, q or !] "))) " [Type y, n, q or !] ")))
(set sym (setq char (read-char-choice prompt char-choices))) (set sym (setq char (read-char-choice prompt char-choices)))
(if (memq char '(?y ?\s ?!)) t))))) (if (memq char '(?y ?\s ?!)) t)))))

View file

@ -47,7 +47,7 @@
;;"f" #'Helper-describe-function ;;"f" #'Helper-describe-function
;;"v" #'Helper-describe-variable ;;"v" #'Helper-describe-variable
"?" #'Helper-help-options "?" #'Helper-help-options
(key-description (char-to-string help-char)) #'Helper-help-options) (help-key) #'Helper-help-options)
(fset 'Helper-help-map Helper-help-map) (fset 'Helper-help-map Helper-help-map)
(defun Helper-help-scroller () (defun Helper-help-scroller ()

View file

@ -173,7 +173,7 @@ The function's value is the number of actions taken."
"%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') " "%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') "
minibuffer-prompt-properties) minibuffer-prompt-properties)
prompt user-keys prompt user-keys
(key-description (vector help-char))))) (help-key))))
(if minibuffer-auto-raise (if minibuffer-auto-raise
(raise-frame (window-frame (minibuffer-window)))) (raise-frame (window-frame (minibuffer-window))))
(unwind-protect (unwind-protect
@ -198,7 +198,7 @@ The function's value is the number of actions taken."
(format (format
"%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') %s" "%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') %s"
prompt user-keys prompt user-keys
(key-description (vector help-char)) (help-key)
(if (equal char -1) (if (equal char -1)
"[end-of-keyboard-macro]" "[end-of-keyboard-macro]"
(single-key-description char)))))) (single-key-description char))))))
@ -279,7 +279,7 @@ Type \\`SPC' or \\`y' to %s the current %s;
(message (substitute-command-keys (message (substitute-command-keys
(format (format
"Type \\`%s' for help" "Type \\`%s' for help"
(key-description (vector help-char))))) (help-key))))
(beep) (beep)
(sit-for 1) (sit-for 1)
(funcall try-again)))) (funcall try-again))))

View file

@ -57,7 +57,7 @@ buffer.")
(defun help-key () (defun help-key ()
"Return `help-char' in a format suitable for the `keymap-set' KEY argument." "Return `help-char' in a format suitable for the `keymap-set' KEY argument."
(key-description (char-to-string help-char))) (key-description (vector help-char)))
(defvar-keymap help-map (defvar-keymap help-map
:doc "Keymap for characters following the Help key." :doc "Keymap for characters following the Help key."

View file

@ -550,7 +550,8 @@ ESC or `q' to quit without changing further buffers,
(new-bfn (and (stringp bfn) (string-replace source target bfn))) (new-bfn (and (stringp bfn) (string-replace source target bfn)))
(prompt (format-message (prompt (format-message
"Set visited file name to `%s' [Type yn!eq or %s] " "Set visited file name to `%s' [Type yn!eq or %s] "
new-bfn (key-description (vector help-char))))) new-bfn (if (fboundp 'help-key) (help-key) ; 29.1
(key-description (vector help-char))))))
(when (and (buffer-live-p buffer) (stringp bfn) (when (and (buffer-live-p buffer) (stringp bfn)
(string-prefix-p source bfn) (string-prefix-p source bfn)
;; Skip, and don't ask again. ;; Skip, and don't ask again.

View file

@ -2213,7 +2213,8 @@ Actual lines: %s"
(let* ((paging-key (concat prefix-keys " " which-key-paging-key)) (let* ((paging-key (concat prefix-keys " " which-key-paging-key))
(paging-key-bound (eq 'which-key-C-h-dispatch (paging-key-bound (eq 'which-key-C-h-dispatch
(key-binding (kbd paging-key)))) (key-binding (kbd paging-key))))
(key (key-description (vector help-char))) (key (if (fboundp 'help-key) (help-key) ; 29.1
(key-description (vector help-char))))
(key (if paging-key-bound (key (if paging-key-bound
(concat key " or " which-key-paging-key) (concat key " or " which-key-paging-key)
key))) key)))