emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/helm 89fb29c93f 2/2: Add key description in symbol affixat


From: ELPA Syncer
Subject: [nongnu] elpa/helm 89fb29c93f 2/2: Add key description in symbol affixation
Date: Tue, 19 Sep 2023 19:00:04 -0400 (EDT)

branch: elpa/helm
commit 89fb29c93f1f670c2b31733e732c5b6f6690c866
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Add key description in symbol affixation
---
 helm-mode.el | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/helm-mode.el b/helm-mode.el
index 3e3ce18e6a..aa3b88e928 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -1051,6 +1051,7 @@ behavior as emacs vanilla.")
     ("trace-function-foreground" . symbol-help)
     ("trace-function-background" . symbol-help)
     ("describe-minor-mode" . symbol-help)
+    ("where-is" . symbol-help)
     ("find-library" . library)
     ("locate-library" . library)
     ("kill-buffer" . buffer)
@@ -1148,7 +1149,8 @@ is used."
            (doc (ignore-errors
                   (helm-get-first-line-documentation sym)))
            (symbol-class (help--symbol-class sym))
-           (group (helm-group-p sym)))
+           (group (helm-group-p sym))
+           (key (helm-completion-get-key sym)))
       (list
        ;; Symbol (comp).
        (if (or (symbol-function sym) (boundp sym)
@@ -1171,9 +1173,17 @@ is used."
        ;; Suffix.
        (if doc
            (helm-aand (propertize doc 'face 'helm-completions-detailed)
-                      (propertize " " 'display (concat sep it)))
+                      (propertize " " 'display (concat sep it key)))
          "")))))
 
+(defun helm-completion-get-key (sym)
+  "Return key description on symbol SYM."
+  (with-helm-current-buffer
+    (let* ((key     (and (commandp sym) (where-is-internal sym nil 
'first-only)))
+           (binding (and key (key-description key))))
+      (when binding
+        (propertize (format " (%s)" binding) 'face 'shadow)))))
+
 (defun helm-completion-package-affixation (_completions)
   (lambda (comp)
     (let* ((sym (intern-soft comp))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]