Function: embark--run-around-action-hooks

embark--run-around-action-hooks is a byte-compiled function defined in embark.el.

Signature

(embark--run-around-action-hooks ACTION TARGET QUIT &optional NON-INTERACTIVE)

Documentation

Run the embark-around-action-hooks for ACTION.

All the applicable around hooks are composed in the order they are present in embark-around-action-hooks. The keys t and
:always in embark-around-action-hooks are treated specially.
The :always hooks are executed always (outermost) and the t hooks are the default hooks, for when there are no command-specific hooks for ACTION. The QUIT, ACTION and TARGET arguments are passed to the hooks as keyword arguments.

The optional argument NON-INTERACTIVE controls whether the action is run with command-execute or with funcall passing the target as argument.

Source Code

;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark--run-around-action-hooks
    (action target quit &optional non-interactive)
  "Run the `embark-around-action-hooks' for ACTION.
All the applicable around hooks are composed in the order they
are present in `embark-around-action-hooks'.  The keys t and
:always in `embark-around-action-hooks' are treated specially.
The :always hooks are executed always (outermost) and the t hooks
are the default hooks, for when there are no command-specific
hooks for ACTION.  The QUIT, ACTION and TARGET arguments are
passed to the hooks as keyword arguments.

The optional argument NON-INTERACTIVE controls whether the action
is run with `command-execute' or with `funcall' passing the
target as argument."
  (apply
   (seq-reduce
    (lambda (fn hook)
      (lambda (&rest args) (apply hook (plist-put args :run fn))))
    (let ((hooks embark-around-action-hooks))
      (reverse
       (append (or (alist-get action hooks) (alist-get t hooks))
               (alist-get :always hooks))))
    (if non-interactive
        (lambda (&rest args)
          (funcall (plist-get args :action)
                   (or (plist-get args :candidates) (plist-get args :target))))
      (lambda (&rest args)
        (command-execute (plist-get args :action)))))
   :action action :quit quit target))