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

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

[nongnu] elpa/helm 00bf87a638: Allow usage of list as value for before/a


From: ELPA Syncer
Subject: [nongnu] elpa/helm 00bf87a638: Allow usage of list as value for before/after-init-hooks (#2534, #2537)
Date: Tue, 2 Aug 2022 10:58:48 -0400 (EDT)

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

    Allow usage of list as value for before/after-init-hooks (#2534, #2537)
    
    Update as well docstring to discourage these usages.
---
 helm-core.el   | 11 ++++++++---
 helm-source.el |  6 ++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index e535945188..03fe03cef0 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -3719,9 +3719,14 @@ For RESUME INPUT DEFAULT and SOURCES see `helm'."
 See :after-init-hook and :before-init-hook in `helm-source'."
   (cl-loop for s in sources
            for hv = (assoc-default hook s)
-           if (and hv (not (symbolp hv))) ; A lambda.
-           do (funcall hv) ; Should raise an error with a list of lambdas.
-           else do (helm-log-run-hook hv)))
+           when hv
+           do (pcase hv
+                ((and (pred (functionp))
+                      (pred (not symbolp))) 
+                 (funcall hv))
+                ((and hook (pred (listp)))
+                 (dolist (h hook) (funcall h)))
+                (_ (helm-log-run-hook hv)))))
 
 (defun helm-restore-position-on-quit ()
   "Restore position in `helm-current-buffer' when quitting."
diff --git a/helm-source.el b/helm-source.el
index 26ceba6811..27fdca76a1 100644
--- a/helm-source.el
+++ b/helm-source.el
@@ -658,7 +658,8 @@
   Should be a variable (a symbol) bound to a list of
   functions or a single function (see `run-hooks' documentation).
   Even better is to use `add-hook' to feed this variable.
-  Can be also an anonymous function, though it is not recommended.")
+  Usage of an anonymous function, or a list of functions is still
+  supported but not recommended.")
 
    (after-init-hook
     :initarg :after-init-hook
@@ -671,7 +672,8 @@
   Should be a variable (a symbol) bound to a list of
   functions or a single function (see `run-hooks' documentation).
   Even better is to use `add-hook' to feed this variable.
-  Can be also an anonymous function, though it is not recommended.")
+  Usage of an anonymous function, or a list of functions is still
+  supported but not recommended.")
 
    (delayed
     :initarg :delayed



reply via email to

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