1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Show character names when describing translations

This implements Bug#71411.

* lisp/help.el (help-key-description): Use 'char-to-name' to show the
Unicode name of translated keys.
(help--describe-command): And here.

* etc/NEWS: Announce the change.
This commit is contained in:
Robert Pluim 2024-06-07 12:21:11 +02:00
parent e4b243b931
commit e3078994d8
2 changed files with 27 additions and 2 deletions

View file

@ -883,7 +883,9 @@ If INSERT (the prefix arg) is non-nil, insert the message in the buffer."
(let ((otherstring (help--key-description-fontified untranslated)))
(if (equal string otherstring)
string
(format "%s (translated from %s)" string otherstring))))))
(if-let ((char-name (char-to-name (aref string 0))))
(format "%s '%s' (translated from %s)" string char-name otherstring)
(format "%s (translated from %s)" string otherstring)))))))
(defun help--binding-undefined-p (defn)
(or (null defn) (integerp defn) (equal defn #'undefined)))
@ -1664,7 +1666,10 @@ Return nil if the key sequence is too long."
(defun help--describe-command (definition &optional translation)
(cond ((or (stringp definition) (vectorp definition))
(if translation
(insert (key-description definition nil) "\n")
(insert (concat (key-description definition nil)
(when-let ((char-name (char-to-name (aref definition 0))))
(format "\t%s" char-name))
"\n"))
;; These should be rare nowadays, replaced by `kmacro's.
(insert "Keyboard Macro\n")))
((keymapp definition)