Emacs Redux

Return to the Essence of Text Editing

Pimp My Minibuffer Evaluation

| Comments

In Emacs you can evaluate Emacs Lisp pretty much anywhere - even in the minibuffer. Writing Emacs Lisp in the minibuffer, however, is not exactly fantastic experience out-of-the-box - there’s TAB completion, but what about eldoc and paredit for instance?

If only there was a way to enable them… I suggested one trick in my original post on eval-expression, but Emacs 24.4 made things even easier by adding eval-expression-minibuffer-setup-hook. To enable eldoc for minibuffer evaluations use this snippet:

1
(add-hook 'eval-expression-minibuffer-setup-hook #'eldoc-mode)

For paredit you can use this one:

1
(add-hook 'eval-expression-minibuffer-setup-hook #'paredit-mode)

Obviously you can do the same for any other minor mode you might need.

The best thing about this setup is that it will work with tools like CIDER and SLIME as well (they have similar commands which allow you to evaluate Clojure & Common Lisp code and those command trigger eval-expression-minibuffer-setup-hook).

Comments