File: embark.el.html
This package provides a sort of right-click contextual menu for
Emacs, accessed through the embark-act command (which you should
bind to a convenient key), offering you relevant actions to use on
a target determined by the context:
- In the minibuffer, the target is the current best completion
candidate.
- In the *Completions* buffer the target is the completion at point.
- In a regular buffer, the target is the region if active, or else the
file, symbol or url at point.
The type of actions offered depend on the type of the target:
- For files you get offered actions like deleting, copying,
renaming, visiting in another window, running a shell command on the
file, etc.
- For buffers the actions include switching to or killing the buffer.
- For package names the actions include installing, removing or
visiting the homepage.
Everything is easily configurable: determining the current target, classifying it, and deciding with actions are offered for each type in the classification. The above introduction just mentions part of the default configuration.
Configuring which actions are offered for a type is particularly
easy and requires no programming: the embark-keymap-alist
variable associates target types with variable containing keymaps,
and those keymaps containing binds for the actions. For example,
in the default configuration the type file is associated with the
symbol embark-file-map. That symbol names a keymap with
single-letter key bindings for common Emacs file commands, for
instance c is bound to copy-file. This means that if while you
are in the minibuffer after running a command that prompts for a
file, such as find-file or rename-file, you can copy a file by
running embark-act and then pressing c.
These action keymaps are very convenient but not strictly necessary
when using embark-act: you can use any command that reads from the
minibuffer as an action and the target of the action will be inserted
at the first minibuffer prompt. After running embark-act all of your
key bindings and even execute-extended-command can be used to run a
command. The action keymaps are normal Emacs keymaps and you should
feel free to bind in them whatever commands you find useful as actions.
The actions in embark-general-map are available no matter what
type of completion you are in the middle of. By default this
includes bindings to save the current candidate in the kill ring
and to insert the current candidate in the previously selected
buffer (the buffer that was current when you executed a command
that opened up the minibuffer).
You can read about the Embark GitHub project wiki: https://github.com/oantolin/embark/wiki/Default-Actions
Besides acting individually on targets, Embark lets you work collectively on a set of target candidates. For example, while you are in the minibuffer the candidates are simply the possible completions of your input. Embark provides three commands to work on candidate sets:
- The embark-act-all command runs the same action on each of the
current candidates. It is just like using embark-act on each
candidate in turn.
- The embark-collect command produces a buffer listing all
candidates, for you to peruse and run actions on at your leisure.
The candidates are displayed as a list showing additional
annotations.
- The embark-export command tries to open a buffer in an
appropriate major mode for the set of candidates. If the
candidates are files export produces a Dired buffer; if they are
buffers, you get an Ibuffer buffer; and if they are packages you
get a buffer in package menu mode.
These are always available as "actions" (although they do not act
on just the current target but on all candidates) for embark-act
and are bound to A, S (for "snapshot") and E, respectively, in
embark-general-map. This means that you do not have to bind your
own key bindings for these (although you can, of course), just a
key binding for embark-act.
Defined variables (87)
embark--advice-regexp | Regexp to match lines about advice in function documentation strings. |
embark--associated-file-fn-alist | Alist of functions that extract a file path from targets of a given type. |
embark--auto-prefix-help-timer | Timer used to decide when to display automatic prefix help. |
embark--backup-prefix-help-command | Previous value ‘prefix-help-command’ to restore. |
embark--command | Command that started the completion session. |
embark--hline | Horizontal line used to separate multiline collect entries. |
embark--prompter-history | History used by the ‘embark-completing-read-prompter’. |
embark--rerun-function | Function to rerun the collect or export that made the current buffer. |
embark--run-after-command-functions | Abnormal hook, used by ‘embark--run-after-command’. |
embark--selection | Buffer local list of selected targets. |
embark--target-buffer | Cache for the previous buffer, meant to be set buffer-locally. |
embark--target-window | Cache for the previous window, meant to be set buffer-locally. |
embark--toggle-quit | Should we toggle the default quitting behavior for the next action? |
embark--type | Cache for the completion type, meant to be set buffer-locally. |
embark-after-export-hook | Hook run after ‘embark-export’ in the newly created buffer. |
embark-around-action-hooks | Alist associating commands with post-action hooks. |
embark-auto-prefix-help-delay | Delay in seconds before automatic prefix help is shown. |
embark-auto-prefix-help-mode | Non-nil if Embark-Auto-Prefix-Help mode is enabled. |
embark-auto-prefix-help-mode-hook | Hook run after entering or leaving ‘embark-auto-prefix-help-mode’. |
embark-become-file+buffer-map | Embark become keymap for files and buffers. |
embark-become-help-map | Keymap for Embark help actions. |
embark-become-keymaps | List of keymaps for ‘embark-become’. |
embark-become-match-map | Embark become keymap for search. |
embark-become-shell-command-map | Embark become keymap for shell commands. |
embark-bookmark-map | Keymap for Embark bookmark actions. |
embark-buffer-map | Keymap for Embark buffer actions. |
embark-candidate-collectors | List of functions that collect all candidates in a given context. |
embark-collect--outline-string | Special string used for outline headings in Embark Collect buffers. |
embark-collect-direct-action-minor-mode | Non-nil if Embark-Collect-Direct-Action minor mode is enabled. |
embark-collect-direct-action-minor-mode-hook | Hook run after entering or leaving ‘embark-collect-direct-action-minor-mode’. |
embark-collect-group-format | Format string used for the group title in Embark Collect buffers. |
embark-collect-mode-hook | Hook run after entering Embark Collect mode. |
embark-collect-mode-map | Keymap for Embark collect mode. |
embark-command-map | Keymap for Embark command actions. |
embark-confirm-act-all | Should ‘embark-act-all’ prompt the user for confirmation? |
embark-cycle-key | Key used for ‘embark-cycle’. |
embark-default-action-overrides | Alist associating target types with overriding default actions. |
embark-defun-map | Keymap for Embark defun actions. |
embark-email-map | Keymap for Embark email actions. |
embark-encode-map | Keymap for Embark region encoding actions. |
embark-exporters-alist | Alist associating completion types to export functions. |
embark-expression-map | Keymap for Embark expression actions. |
embark-face-map | Keymap for Embark face actions. |
embark-file-map | Keymap for Embark file actions. |
embark-flymake-map | Keymap for Embark actions on Flymake diagnostics. |
embark-function-map | Keymap for Embark function actions. |
embark-general-map | Keymap for Embark general actions. |
embark-heading-map | Keymap for Embark heading actions. |
embark-help-key | Key used for help. |
embark-identifier-map | Keymap for Embark identifier actions. |
embark-indicators | Indicator functions to use when acting or becoming. |
embark-keybinding-repeat | Indicator string for repeatable keybindings. |
embark-keymap-alist | Alist of action types and corresponding keymaps. |
embark-keymap-prompter-key | Key to switch to the keymap prompter from ‘embark-completing-read-prompter’. |
embark-kill-ring-map | Keymap for ‘kill-ring’ commands. |
embark-library-map | Keymap for operations on Emacs Lisp libraries. |
embark-meta-map | Keymap for non-action Embark functions. |
embark-mixed-indicator-both | Show both indicators, even after the verbose indicator appeared. |
embark-mixed-indicator-delay | Time in seconds after which the verbose indicator is shown. |
embark-multitarget-actions | Commands for which ‘embark-act-all’ should pass a list of targets. |
embark-package-map | Keymap for Embark package actions. |
embark-paragraph-map | Keymap for Embark actions for dealing with paragraphs. |
embark-post-action-hooks | Alist associating commands with post-action hooks. |
embark-pre-action-hooks | Alist associating commands with pre-action hooks. |
embark-prompter | Function used to prompt the user for actions. |
embark-prose-map | Keymap for Embark actions for dealing with prose. |
embark-quit-after-action | Should ‘embark-act’ quit the minibuffer? |
embark-record-minibuffer-history | Control when acted-on minibuffer candidates go into history. |
embark-region-map | Keymap for Embark actions on the active region. |
embark-repeat-actions | List of repeatable actions. |
embark-selection-indicator | Mode line indicator used for selected candidates. |
embark-sentence-map | Keymap for Embark actions for dealing with sentences. |
embark-separator-history | Input history for the separators used by some embark commands. |
embark-sort-map | Keymap for Embark actions that sort the region |
embark-symbol-map | Keymap for Embark symbol actions. |
embark-tab-map | Keymap for actions for tab-bar tabs. |
embark-target-finders | List of functions to determine the target in current context. |
embark-target-injection-hooks | Alist associating commands with post-injection setup hooks. |
embark-transformer-alist | Alist associating type to functions for transforming targets. |
embark-unicode-name-map | Keymap for Embark Unicode name actions. |
embark-url-map | Keymap for Embark url actions. |
embark-variable-map | Keymap for Embark variable actions. |
embark-vc-file-map | Keymap for Embark VC file actions. |
embark-verbose-indicator-buffer-sections | List of sections to display in the verbose indicator buffer, in order. |
embark-verbose-indicator-display-action | Parameters added to ‘display-buffer-alist’ to show the actions buffer. |
embark-verbose-indicator-excluded-actions | Commands not displayed by ‘embark-verbose-indicator’. |
embark-verbose-indicator-nested | Whether the verbose indicator should use nested keymap navigation. |
Defined functions (194)
Defined faces (12)
embark-collect-annotation | Face for annotations in Embark Collect. This is only used for annotation that are not already fontified. |
embark-collect-candidate | Face for candidates in Embark Collect buffers. |
embark-collect-group-separator | Face for group titles in Embark Collect buffers. |
embark-collect-group-title | Face for group titles in Embark Collect buffers. |
embark-keybinding | Face used to display key bindings. Used by `embark-completing-read-prompter' and `embark-keymap-help'. |
embark-keybinding-repeat | Face used to indicate keybindings as repeatable. |
embark-keymap | Face used to display keymaps. Used by `embark-completing-read-prompter' and `embark-keymap-help'. |
embark-selected | Face for selected candidates. |
embark-target | Face used to highlight the target at point during `embark-act'. |
embark-verbose-indicator-documentation | Face used by the verbose action indicator to display binding descriptions. Used by `embark-verbose-indicator'. |
embark-verbose-indicator-shadowed | Face used by the verbose action indicator for the shadowed targets. Used by `embark-verbose-indicator'. |
embark-verbose-indicator-title | Face used by the verbose action indicator for the title. Used by `embark-verbose-indicator'. |