branch: elpa/helm commit f5159e17b8f40f262310504767651e1b953ea779 Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Revert "Ensure init hooks are defined as symbol functions" (Fix #2534) This reverts commit 5da20ad1f78a4e7f5d89abb245ce55122f40772d. --- helm-core.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/helm-core.el b/helm-core.el index 816da6a01d..67be4243a8 100644 --- a/helm-core.el +++ b/helm-core.el @@ -3697,13 +3697,16 @@ For RESUME INPUT DEFAULT and SOURCES see `helm'." (defun helm--run-init-hooks (hook sources) "Run after and before init hooks local to source. See :after-init-hook and :before-init-hook in `helm-source'." - (cl-loop for s in sources + (cl-loop with sname = (cl-ecase hook + (before-init-hook "h-before-init-hook") + (after-init-hook "h-after-init-hook")) + with h = (cl-gensym sname) + for s in sources for hv = (assoc-default hook s) - if (symbolp hv) - do (helm-log-run-hook hv) - else return - (error "`%s' hook in source `%s' not specified as symbol function" - hook (helm-attr 'name s)))) + if (and hv (not (symbolp hv))) + do (set h hv) + and do (helm-log-run-hook h) + else do (helm-log-run-hook hv))) (defun helm-restore-position-on-quit () "Restore position in `helm-current-buffer' when quitting."