Function: embark--formatted-bindings
embark--formatted-bindings is a byte-compiled function defined in
embark.el.
Signature
(embark--formatted-bindings KEYMAP &optional NESTED)
Documentation
Return the formatted keybinding of KEYMAP.
The keybindings are returned in their order of appearance. If NESTED is non-nil subkeymaps are not flattened.
Source Code
;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark--formatted-bindings (keymap &optional nested)
"Return the formatted keybinding of KEYMAP.
The keybindings are returned in their order of appearance.
If NESTED is non-nil subkeymaps are not flattened."
(let* ((commands
(cl-loop for (key . def) in (embark--all-bindings keymap nested)
for name = (embark--command-name def)
for cmd = (keymap--menu-item-binding def)
unless (memq cmd '(nil embark-keymap-help
negative-argument digit-argument))
collect (list name cmd key
(concat
(if (eq (car-safe def) 'menu-item)
"menu-item"
(key-description key))))))
(width (cl-loop for (_name _cmd _key desc) in commands
maximize (length desc)))
(default)
(candidates
(cl-loop for item in commands
for (name cmd key desc) = item
for desc-rep =
(concat
(propertize desc 'face 'embark-keybinding)
(and (embark--action-repeatable-p cmd)
embark-keybinding-repeat))
for formatted =
(propertize
(concat desc-rep
(make-string (- width (length desc-rep) -1) ?\s)
name)
'embark-command cmd)
when (equal key [13])
do (setq default formatted)
collect (cons formatted item))))
(cons candidates default)))