Skip to content

The default action on a target

Embark has a notion of default action for a target:

  • If the target is a minibuffer completion candidate, then the default action is whatever command opened the minibuffer in the first place. For example if you run ‘kill-buffer’, then the default action will be to kill buffers.
  • If the target comes from a regular buffer (i.e., not a minibuffer), then the default action is whatever is bound to ‘RET’ in the keymap of actions for that type of target. For example, in Embark’s default configuration for a URL found at point the default action is ‘browse-url’, because ‘RET’ is bound to ‘browse-url’ in the ‘embark-url-map’ keymap.

To run the default action you can press ‘RET’ after running ‘embark-act’. Note that if there are several different targets at a given location, each has its own default action, so first cycle to the target you want and then press ‘RET’ to run the corresponding default action.

There is also ‘embark-dwim’ which runs the default action for the first target found. It’s pretty handy in non-minibuffer buffers: with Embark’s default configuration it will:

  • Open the file at point.
  • Open the URL at point in a web browser (using the ‘browse-url’ command).
  • Compose a new email to the email address at point.
  • In an Emacs Lisp buffer, if point is on an opening parenthesis or right after a closing one, it will evaluate the corresponding expression.
  • Go to the definition of an Emacs Lisp function, variable or macro at point.
  • Find the file corresponding to an Emacs Lisp library at point.