Function: which-key--propertize-description
which-key--propertize-description is a byte-compiled function defined
in which-key.el.gz.
Signature
(which-key--propertize-description DESCRIPTION GROUP LOCAL HL-FACE &optional ORIGINAL-DESCRIPTION)
Documentation
Add face to DESCRIPTION.
The face chosen depends on whether the description represents a group or a command. Also make some minor adjustments to the description string, like removing a "group:" prefix.
ORIGINAL-DESCRIPTION is the description given by
describe-buffer-bindings.
Source Code
;; Defined in /usr/src/emacs/lisp/which-key.el.gz
(defun which-key--propertize-description
(description group local hl-face &optional original-description)
"Add face to DESCRIPTION.
The face chosen depends on whether the description represents a
group or a command. Also make some minor adjustments to the
description string, like removing a \"group:\" prefix.
ORIGINAL-DESCRIPTION is the description given by
`describe-buffer-bindings'."
(when description
(let* ((desc description)
(desc (if (string-match-p "^group:" desc)
(substring desc 6) desc))
(desc (if group (concat which-key-prefix-prefix desc) desc)))
(make-text-button
desc nil
'face (cond (hl-face hl-face)
(group 'which-key-group-description-face)
(local 'which-key-local-map-description-face)
(t 'which-key-command-description-face))
'help-echo (cond
((and original-description
(fboundp (intern original-description))
(documentation (intern original-description))
;; tooltip-mode doesn't exist in emacs-nox
(boundp 'tooltip-mode) tooltip-mode)
(documentation (intern original-description)))
((and original-description
(fboundp (intern original-description))
(documentation (intern original-description))
(let* ((doc (documentation
(intern original-description)))
(str (replace-regexp-in-string "\n" " " doc))
(max (floor (* (frame-width) 0.8))))
(if (> (length str) max)
(concat (substring str 0 max) "...")
str)))))))))