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

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

[nongnu] elpa/helm 587be477fe 4/7: Allow inserting code before running a


From: ELPA Syncer
Subject: [nongnu] elpa/helm 587be477fe 4/7: Allow inserting code before running action in helm-make-command-from-action
Date: Sat, 17 Sep 2022 04:58:55 -0400 (EDT)

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

    Allow inserting  code before running action in helm-make-command-from-action
---
 helm-core.el | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index 911f1615bc..8d0779500d 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -2121,16 +2121,36 @@ End:")
       'helm-display-function 'helm-display-buffer-in-own-frame)
      ,@body))
 
-(defmacro helm-make-command-from-action (symbol doc action)
+(defmacro helm-make-command-from-action (symbol doc action &rest body)
   "Make a command SYMBOL from ACTION with docstring DOC.
 The command SYMBOL will quit helm before execute.
-Argument ACTION should be an existing helm action."
+Argument ACTION should be an existing helm action.
+BODY form will run before calling action.
+
+Example:
+
+    (helm-make-command-from-action foo-command
+        \"Docstring\"
+      \\='foo-action
+      (run body))
+
+will produce a command like this:
+
+    (defun foo-command ()
+      \"docstring\"
+      (interactive)
+      (with-helm-alive-p
+        (run body)
+        (helm-exit-and-execute-action \\='foo-action)))
+
+And automatically put the symbol \\='helm-only on SYMBOL."
   (declare (indent defun) (debug t))
   `(progn
      (defun ,symbol ()
        ,doc
        (interactive)
        (with-helm-alive-p
+         (progn ,@body)
          (helm-exit-and-execute-action ,action)))
      (put ',symbol 'helm-only t)))
 



reply via email to

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