Function: embark-dwim

embark-dwim is an autoloaded, interactive and byte-compiled function defined in embark.el.

Signature

(embark-dwim &optional ARG)

Documentation

Run the default action on the current target.

The target of the action is chosen by embark-target-finders.

If the target comes from minibuffer completion, then the default action is the command that opened the minibuffer in the first place, unless overridden by embark-default-action-overrides.

For targets that do not come from minibuffer completion
(typically some thing at point in a regular buffer) and whose
type is not listed in embark-default-action-overrides, the default action is given by whatever binding RET has in the action keymap for the target's type.

See embark-act for the meaning of the prefix ARG.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
;;;###autoload
(defun embark-dwim (&optional arg)
  "Run the default action on the current target.
The target of the action is chosen by `embark-target-finders'.

If the target comes from minibuffer completion, then the default
action is the command that opened the minibuffer in the first
place, unless overridden by `embark-default-action-overrides'.

For targets that do not come from minibuffer completion
\(typically some thing at point in a regular buffer) and whose
type is not listed in `embark-default-action-overrides', the
default action is given by whatever binding RET has in the action
keymap for the target's type.

See `embark-act' for the meaning of the prefix ARG."
  (interactive "P")
  (if-let* ((targets (embark--targets)))
      (let* ((target
              (or (nth
                   (if (or (null arg) (minibufferp))
                       0
                     (mod (prefix-numeric-value arg) (length targets)))
                   targets)))
             (type (plist-get target :type))
             (default-action (embark--default-action type))
             (command-remapping (command-remapping default-action))
             (action (or (unless (eq 'embark-dwim command-remapping) command-remapping) default-action)))
        (unless action
          (user-error "No default action for %s targets" type))
        (when (and arg (minibufferp)) (setq embark--toggle-quit t))
        (embark--act action
                     (if (and (eq default-action embark--command)
                              (not (memq default-action
                                         embark-multitarget-actions)))
                         (embark--orig-target target)
                       target)
                     (embark--quit-p action)))
    (user-error "No target found")))