0

I would like to define my own hook, where the result of each caller is collected (when the hook is run).

Is there a way to do this?

Currently I pass in a function to the hook, that function can be run with the result of the hook, but this feels quite awkward,

(defun my-hook (fn-result)
  ;; This allows me to emit a result for each function, but isn't nice.
  (funcall fn-result (+ 1 1)))

(add-hook 'my-custom-hook #'my-hook)
2
  • The solution, as the question is written, is to append or push or just add the result to a local or global variable. But, since you already know that, I suspect the question needs more details ... – lawlist Feb 3 at 6:29
  • If this is the only solution, it seems fairly awkward, but good to know there are no better options. – ideasman42 Feb 3 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.