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

    introduce marginalia-annotate-command
    
    Like marginalia-annotate-symbol, but does not show symbol-class.
    The symbol-class feels like unnecessary noise for M-x.
---
 marginalia.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/marginalia.el b/marginalia.el
index 96375a1..c34628b 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -170,7 +170,7 @@ See also `marginalia-annotators-heavy'."
    '((file . marginalia-annotate-file)
      (buffer . marginalia-annotate-buffer)
      (virtual-buffer . marginalia-annotate-virtual-buffer-full)
-     (command . marginalia-annotate-symbol))
+     (command . marginalia-annotate-command))
    marginalia-annotators-light)
   "Heavy annotator functions.
 
@@ -382,6 +382,14 @@ a face"
         (t (documentation-property sym 'variable-documentation)))
        :truncate marginalia-truncate-width :face 'marginalia-documentation)))))
 
+(defun marginalia-annotate-command (cand)
+  "Annotate command CAND with its documentation string.
+Similar to `marginalia-annotate-symbol', but does not show symbol class."
+  (when-let (sym (intern-soft cand))
+    (concat
+     (marginalia-annotate-binding cand)
+     (marginalia--documentation (marginalia--function-doc sym)))))
+
 (defun marginalia-annotate-imenu (cand)
   "Annotate imenu CAND with its documentation string."
   (when (provided-mode-derived-p (buffer-local-value 'major-mode

Reply via email to