diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2022-08-19 20:19:59 +0200 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2022-08-19 20:36:12 +0200 |
commit | a936335aa02bd6d142ce61563e6cf70a1a7c271b (patch) | |
tree | d1dc84297b9b84d698cc130e79b7cbb5681fb031 /lisp | |
parent | 935e4da0e1389fd5a8f836ac81dc53d698f4439f (diff) | |
download | emacs-a936335aa02bd6d142ce61563e6cf70a1a7c271b.tar.gz emacs-a936335aa02bd6d142ce61563e6cf70a1a7c271b.tar.bz2 emacs-a936335aa02bd6d142ce61563e6cf70a1a7c271b.zip |
Fix return value of help--key-description-fontified
This fixes a bug with warning about obsolete commands in
`command-execute', where we incorrectly showed empty parenthesis
instead of the empty string when there was no keybinding for the new
command.
* lisp/help.el (help--key-description-fontified): Return nil instead
of the empty string if KEYS argument is nil.
* test/lisp/help-tests.el (help--key-description-fontified): New test.
(with-substitute-command-keys-test): Fix indentation.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/help.el | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/help.el b/lisp/help.el index 37aab15df05..15ab3192ad7 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -566,13 +566,16 @@ To record all your input, use `open-dribble-file'." ;; Key bindings (defun help--key-description-fontified (keys &optional prefix) - "Like `key-description' but add face for \"*Help*\" buffers." - ;; We add both the `font-lock-face' and `face' properties here, as this - ;; seems to be the only way to get this to work reliably in any - ;; buffer. - (propertize (key-description keys prefix) - 'font-lock-face 'help-key-binding - 'face 'help-key-binding)) + "Like `key-description' but add face for \"*Help*\" buffers. +KEYS is the return value of `(where-is-internal \\='foo-cmd nil t)'. +Return nil if KEYS is nil." + (when keys + ;; We add both the `font-lock-face' and `face' properties here, as this + ;; seems to be the only way to get this to work reliably in any + ;; buffer. + (propertize (key-description keys prefix) + 'font-lock-face 'help-key-binding + 'face 'help-key-binding))) (defcustom describe-bindings-outline t "Non-nil enables outlines in the output buffer of `describe-bindings'." |