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

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

[nongnu] elpa/helm da114dfc9c 3/3: Add a new arg DOCSTRING to helm-defin


From: ELPA Syncer
Subject: [nongnu] elpa/helm da114dfc9c 3/3: Add a new arg DOCSTRING to helm-define-key-with-subkeys
Date: Thu, 21 Jul 2022 14:58:42 -0400 (EDT)

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

    Add a new arg DOCSTRING to helm-define-key-with-subkeys
    
    If specified use it otherwise generate a basic docstring.
---
 helm-core.el | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index ed88920deb..464b6bdf6b 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -131,6 +131,7 @@ and second call within 1s runs `helm-swap-windows'."
 
 (defun helm-command-with-subkeys (map subkey command
                                   &optional other-subkeys prompt exit-fn delay)
+  "Return an anonymous interactive command to use with 
`helm-define-multi-key'."
   (lambda ()
     (interactive)
     (let (timer)
@@ -166,7 +167,9 @@ and second call within 1s runs `helm-swap-windows'."
 
 ;;;###autoload
 (defun helm-define-key-with-subkeys (map key subkey command
-                                         &optional other-subkeys prompt 
exit-fn delay)
+                                         &optional other-subkeys
+                                           prompt exit-fn delay
+                                           docstring)
   "Define in MAP a KEY and SUBKEY to COMMAND.
 
 This allows typing KEY to call COMMAND the first time and
@@ -205,12 +208,15 @@ i.e. the loop is not entered after running COMMAND."
         (com (intern (format "helm-%s-with-subkeys"
                              (symbol-name command)))))
     (defalias com fn
-      (concat
-       (format "Run `%s' and bound it to `%s' for subsequent calls."
-               command (if (numberp subkey) (char-to-string subkey) subkey))
-       (if other-subkeys
-           (helm-basic-docstring-from-alist other-subkeys)
-         "")))
+      (or docstring
+          ;; When no DOCSTRING, generate a basic one specifying
+          ;; COMMAND, SUBKEY and OTHER-SUBKEYS.
+          (concat
+           (format "Run `%s' and bound it to `%s' for subsequent calls."
+                   command (if (numberp subkey) (char-to-string subkey) 
subkey))
+           (if other-subkeys
+               (helm-basic-docstring-from-alist other-subkeys)
+             ""))))
     (define-key map key com)))
 
 (defun helm-basic-docstring-from-alist (alist)



reply via email to

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