branch: externals/marginalia
commit 57b117681e65194afb9b0dc0594e40e281a81326
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    marginalia-annotate-command-binding: only store the binding in the hash 
table
    
    No need to cache anything else, the slowness is purely due to 
where-is-internal.
---
 marginalia.el | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/marginalia.el b/marginalia.el
index 78f4007..c0f4b37 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -226,11 +226,9 @@ determine it."
       (cl-do-all-symbols (sym)
         (when (commandp sym)
           (when-let (key (where-is-internal sym nil t))
-            (puthash sym
-                     (propertize (format " (%s)" (key-description key))
-                                 'face 'marginalia-key)
-                     marginalia-annotate-command-binding--hash)))))
-    (gethash (intern cand) marginalia-annotate-command-binding--hash)))
+            (puthash sym key marginalia-annotate-command-binding--hash)))))
+    (when-let (binding (gethash (intern cand) 
marginalia-annotate-command-binding--hash))
+      (propertize (format " (%s)" (key-description binding)) 'face 
'marginalia-key))))
 
 (defun marginalia-annotate-command-full (cand)
   "Annotate command CAND with the keybinding and its documentation string."

Reply via email to