Function: which-key--format-and-replace
which-key--format-and-replace is a byte-compiled function defined in
which-key.el.gz.
Signature
(which-key--format-and-replace UNFORMATTED &optional PRESERVE-FULL-KEY)
Documentation
Make list of key bindings with separators and descriptions.
Take a list of (key . desc) cons cells in UNFORMATTED, add faces and perform replacements according to the three replacement alists. Return a list (key separator description).
Source Code
;; Defined in /usr/src/emacs/lisp/which-key.el.gz
(defun which-key--format-and-replace (unformatted &optional preserve-full-key)
"Make list of key bindings with separators and descriptions.
Take a list of (key . desc) cons cells in UNFORMATTED, add
faces and perform replacements according to the three replacement
alists. Return a list (key separator description)."
(let ((sep-w-face
(which-key--propertize which-key-separator
'face 'which-key-separator-face))
(local-map (current-local-map))
(avl-width (cdr (which-key--popup-max-dimensions)))
new-list)
(dolist (key-binding unformatted)
(let* ((keys (car key-binding))
(orig-desc (cdr key-binding))
(group (which-key--group-p orig-desc))
(local (eq (which-key--safe-lookup-key-description
local-map keys)
(intern orig-desc)))
(hl-face (which-key--highlight-face orig-desc))
(key-binding (which-key--maybe-replace key-binding))
(final-desc (which-key--propertize-description
(cdr key-binding) group local hl-face orig-desc)))
(when final-desc
(setq final-desc
(which-key--truncate-description
(which-key--maybe-add-docstring final-desc orig-desc)
avl-width)))
(when (consp key-binding)
(push
(list (which-key--propertize-key
(if preserve-full-key
(car key-binding)
(which-key--extract-key (car key-binding))))
sep-w-face
final-desc)
new-list))))
(nreverse new-list)))