about | blog | config | notes | github

1. Minibuffer Actions Rooted in Keymaps

embark provides actions for minibuffer stuff.

2. Configuration

2.1. Package Install

Time to setup the embark package.

(use-package embark
  :bind (
  ;; Run the context menu for embark
  ("M-a"   . embark-act)
  ;; Run the context menu for embark but do not quit
  ("M-S-a" . zamlz/embark-act-noquit)
  ;; alternative for `describe-bindings'
  ("C-h B" . embark-bindings)))

2.2. Embark-Act No Quit

This is a simple function that lets us run embark-act but not quit after running the corresponding action. For some reason this doesn't work as expected…

(defun zamlz/embark-act-noquit ()
  "Run action but don't quit the minibuffer afterwards."
  (let ((embark-quit-after-action nil))

2.3. Consult Integration

This also sets up Consult integration for embark.

(use-package embark-consult
  :after (embark consult)
  :demand t ; only necessary if you have the hook below
  ;; if you want to have consult previews as you move around an
  ;; auto-updating embark collect buffer
  (embark-collect-mode . consult-preview-at-point-mode))

2.4. Which Key Integration

When running embark-act, let's make sure to use which-key so that we don't have to always remember which keys are available to us.

(setq embark-action-indicator
      (lambda (map _target)
        (which-key--show-keymap "Embark" map nil nil 'no-paging)
      embark-become-indicator embark-action-indicator)

2.5. Feature Provide

(provide 'init-embark)

Created: 2021-11-13

Emacs 26.1 (Org mode 9.5)