diff options
author | Eli Zaretskii <eliz@gnu.org> | 2021-12-08 16:22:10 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2021-12-08 16:22:10 +0200 |
commit | 538fc1d0e07aed0e535d9e9f2063f429238df422 (patch) | |
tree | 2c1b1ebe40ff909d76cc2008fa269a049fd7386d /lisp/help.el | |
parent | c8c7822c51325ed300c0ffb91ce42e1868c6bda4 (diff) | |
download | emacs-538fc1d0e07aed0e535d9e9f2063f429238df422.tar.gz emacs-538fc1d0e07aed0e535d9e9f2063f429238df422.tar.bz2 emacs-538fc1d0e07aed0e535d9e9f2063f429238df422.zip |
Fix mode-line display in Calendar mode
* lisp/help.el (substitute-command-keys): New optional argument
NO-FACE, to avoid putting the 'help-key-binding' face on the key
bindings.
* lisp/calendar/calendar.el (calendar-mode-line-entry): Call
'substitute-command-keys' with the new optional argument non-nil.
(Bug#52366)
* doc/lispref/help.texi (Keys in Documentation): Document the new
optional argument of 'substitute-command-keys'.
* etc/NEWS: Announce the addition of a new argument to
'substitute-command-keys'.
Diffstat (limited to 'lisp/help.el')
-rw-r--r-- | lisp/help.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/help.el b/lisp/help.el index 47faf44b37f..941d4cfab12 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1060,11 +1060,12 @@ is currently activated with completion." result)) -(defun substitute-command-keys (string) +(defun substitute-command-keys (string &optional no-face) "Substitute key descriptions for command names in STRING. Each substring of the form \\\\=[COMMAND] is replaced by either a keystroke sequence that invokes COMMAND, or \"M-x COMMAND\" if COMMAND -is not on any keys. Keybindings will use the face `help-key-binding'. +is not on any keys. Keybindings will use the face `help-key-binding', +unless the optional argument NO-FACE is non-nil. Each substring of the form \\\\={MAPVAR} is replaced by a summary of the value of MAPVAR as a keymap. This summary is similar to the one @@ -1141,13 +1142,17 @@ Otherwise, return a new string." (let ((op (point))) (insert "M-x ") (goto-char (+ end-point 3)) - (add-text-properties op (point) - '( face help-key-binding - font-lock-face help-key-binding)) + (or no-face + (add-text-properties + op (point) + '( face help-key-binding + font-lock-face help-key-binding))) (delete-char 1)) ;; Function is on a key. (delete-char (- end-point (point))) - (insert (help--key-description-fontified key))))) + (insert (if no-face + (key-description key) + (help--key-description-fontified key)))))) ;; 1D. \{foo} is replaced with a summary of the keymap ;; (symbol-value foo). ;; \<foo> just sets the keymap used for \[cmd]. |