views:

67

answers:

1

I love Emacs' paredit-mode, but I miss it very sorely when doing eval-expression (M-:). How can I have paredit in the minibuffer when doing eval-expression? Thanks!

+4  A: 

Add a function to minibuffer-setup-hook, like so:

(add-hook 'minibuffer-setup-hook 'conditionally-enable-paredit-mode)
(defun conditionally-enable-paredit-mode ()
  "enable paredit-mode during eval-expression"
  (if (eq this-command 'eval-expression)
      (paredit-mode 1)))
Trey Jackson
Not bad, but as you allude to that applies paredit to everything (ex. `shell-command`/`M-!`) and not just Emacs Lisp entry in the minibuffer. I'd prefer that not be the case.I wonder if I'll end up having to replace `eval-expression` with something that calls a more special read function.
draebek
It enables it only for eval-expression, but maybe you wrote your comment before Trey edited his answer...
Bozhidar Batsov
Yup, I did write it before it was a hook looking at `this-command`. I didn't think of doing that. Thanks!
draebek