Function: embark--act
embark--act is a byte-compiled function defined in embark.el.
Signature
(embark--act ACTION TARGET &optional QUIT)
Documentation
Perform ACTION injecting the TARGET.
If called from a minibuffer with non-nil QUIT, quit the minibuffer before executing the action.
Source Code
;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark--act (action target &optional quit)
"Perform ACTION injecting the TARGET.
If called from a minibuffer with non-nil QUIT, quit the
minibuffer before executing the action."
(embark--record-target-in-history action target)
(if (memq action '(embark-become ; these actions should run in
embark-collect ; the current buffer, not the
embark-live ; target buffer
embark-export
embark-select
embark-act-all))
(progn
(embark--run-action-hooks embark-pre-action-hooks action target quit)
(unwind-protect (embark--run-around-action-hooks action target quit)
(embark--run-action-hooks embark-post-action-hooks
action target quit)))
(let* ((command embark--command)
(prefix prefix-arg)
(action-window (embark--target-window t))
(directory default-directory)
(inject
(lambda ()
(let ((contents (minibuffer-contents)))
(delete-minibuffer-contents)
(insert
(propertize
(substring-no-properties (plist-get target :target))
'embark--initial-input contents)))
(if (memq 'ivy--queue-exhibit post-command-hook)
;; Ivy has special needs: (1) for file names
;; ivy-immediate-done is not equivalent to
;; exit-minibuffer, (2) it needs a chance to run
;; its post command hook first, so use depth 10
(add-hook 'post-command-hook 'ivy-immediate-done 10 t)
(add-hook 'post-command-hook #'exit-minibuffer nil t))
(embark--run-action-hooks embark-target-injection-hooks
action target quit)))
(dedicate (and (derived-mode-p 'embark-collect-mode)
(not (window-dedicated-p))
(selected-window)))
(multi (memq action embark-multitarget-actions))
(run-action
(if (and (commandp action) (not multi))
(lambda ()
(let (final-window)
(when dedicate (set-window-dedicated-p dedicate t))
(unwind-protect
(with-selected-window action-window
(let ((enable-recursive-minibuffers t)
(embark--command command)
(prefix-arg prefix)
;; the next two avoid mouse dialogs
(use-dialog-box nil)
(last-nonmenu-event 13)
(default-directory directory))
(embark--run-action-hooks embark-pre-action-hooks
action target quit)
(minibuffer-with-setup-hook inject
;; HACK work around `browse-url-interactive-arg'
;; expecting a non-empty `this-command-keys'
;; output.
(when (and (eq action 'browse-url)
(= (length (this-command-keys)) 0))
(set--this-command-keys
(if (characterp last-command-event)
(string last-command-event)
"\r")))
(setq this-command action)
(embark--run-around-action-hooks
action target quit)))
(setq final-window (selected-window)))
(embark--run-action-hooks embark-post-action-hooks
action target quit)
(when dedicate (set-window-dedicated-p dedicate nil)))
(unless (eq final-window action-window)
(select-window final-window))))
(let ((target
(if (and multi (null (plist-get target :candidates)))
(plist-put
target :candidates (list (plist-get target :target)))
target)))
(lambda ()
(with-selected-window action-window
(embark--run-action-hooks embark-pre-action-hooks
action target quit)
(unwind-protect
(let ((current-prefix-arg prefix)
(default-directory directory))
(embark--run-around-action-hooks
action target quit :non-interactive))
(embark--run-action-hooks embark-post-action-hooks
action target quit))))))))
(setq prefix-arg nil)
(if quit (embark--quit-and-run run-action) (funcall run-action)))))