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 help-key)
("28.1" fun always)
("27.1" fun project-files)
("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)
(if help-form
(format " [Type yn!q or %s] "
(key-description (vector help-char)))
(help-key))
" [Type y, n, q or !] ")))
(set sym (setq char (read-char-choice prompt char-choices)))
(if (memq char '(?y ?\s ?!)) t)))))

View file

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

View file

@ -57,7 +57,7 @@ buffer.")
(defun help-key ()
"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
: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)))
(prompt (format-message
"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)
(string-prefix-p source bfn)
;; 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))
(paging-key-bound (eq 'which-key-C-h-dispatch
(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
(concat key " or " which-key-paging-key)
key)))