all repos — nixfiles @ ce50593b3cc4898915c260aaf356adf533868e67

System and user configuration, managed by nix and home-manager

Emacs: Simplify paredit eval-expression setup
Alan Pearce alan@alanpearce.co.uk
Thu, 24 Mar 2016 23:11:44 +0100
commit

ce50593b3cc4898915c260aaf356adf533868e67

parent

94fa9d4f837d1363bf4aaa0f2afb5fbc9a91b81f

1 files changed, 8 insertions(+), 12 deletions(-)

jump to
M tag-emacs/emacs.d/init.orgtag-emacs/emacs.d/init.org
@@ -2216,18 +2216,14 @@ Balanced parentheses in lisps are nice, but all the refactoring and movement commands are much more interesting.
 
 #+BEGIN_SRC emacs-lisp
-(use-package paredit
-  :diminish "()"
-  :commands (paredit-mode)
-  :init (progn
-          (add-hook 'lisp-mode-common-hook #'enable-paredit-mode)
-          (put #'paredit-forward-delete 'delete-selection 'supersede)
-          (put #'paredit-backward-delete 'delete-selection 'supersede)
-          (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)))))
+  (use-package paredit
+    :diminish "()"
+    :commands (paredit-mode)
+    :init (progn
+            (add-hook 'lisp-mode-common-hook #'enable-paredit-mode)
+            (put #'paredit-forward-delete 'delete-selection 'supersede)
+            (put #'paredit-backward-delete 'delete-selection 'supersede)
+            (add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)))
 #+END_SRC
 
 ** smartparens