branch: externals/marginalia commit fbd898d68233d24813a7d7bc9fe8c477ed623382 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
rename marginalia-annotate-command to marginalia-annotate-binding --- marginalia.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/marginalia.el b/marginalia.el index 8386480..96375a1 100644 --- a/marginalia.el +++ b/marginalia.el @@ -143,7 +143,7 @@ only with the annotations that come with Emacs) without disabling :group 'marginalia) (defcustom marginalia-annotators-light - '((command . marginalia-annotate-command) + '((command . marginalia-annotate-binding) (customize-group . marginalia-annotate-customize-group) (variable . marginalia-annotate-variable) (face . marginalia-annotate-face) @@ -279,24 +279,24 @@ WIDTH is the format width. This can be specified as alternative to FORMAT." (marginalia--fields (str :truncate marginalia-truncate-width :face 'marginalia-documentation)))) -(defvar-local marginalia-annotate-command--hash nil +(defvar-local marginalia-annotate-binding--hash nil "Hash table storing the keybinding of every command. -This hash table is needed to speed up `marginalia-annotate-command'.") +This hash table is needed to speed up `marginalia-annotate-binding'.") -(defun marginalia-annotate-command (cand) +(defun marginalia-annotate-binding (cand) "Annotate command CAND with keybinding." (with-current-buffer (window-buffer (minibuffer-selected-window)) ;; Precomputing the keybinding of every command is faster than looking it up every time using ;; `where-is-internal'. `where-is-internal' generates a lot of garbage, leading to garbage ;; collecting pauses when interacting with the minibuffer. See ;; https://github.com/minad/marginalia/issues/16. - (unless marginalia-annotate-command--hash - (setq marginalia-annotate-command--hash (make-hash-table)) + (unless marginalia-annotate-binding--hash + (setq marginalia-annotate-binding--hash (make-hash-table)) (cl-do-all-symbols (sym) (when-let (key (and (commandp sym) (where-is-internal sym nil t))) - (puthash sym key marginalia-annotate-command--hash)))) + (puthash sym key marginalia-annotate-binding--hash)))) (when-let* ((sym (intern-soft cand)) - (binding (gethash sym marginalia-annotate-command--hash))) + (binding (gethash sym marginalia-annotate-binding--hash))) (propertize (format " (%s)" (key-description binding)) 'face 'marginalia-key)))) ;; This annotator is consult-specific, it will annotate the `consult-buffer' command. @@ -373,7 +373,7 @@ a face" "Annotate symbol CAND with its documentation string." (when-let (sym (intern-soft cand)) (concat - (marginalia-annotate-command cand) + (marginalia-annotate-binding cand) (marginalia--fields ((marginalia--symbol-class sym) :face 'marginalia-modified) ((cond