all repos — nixfiles @ 2fd077caef472d4e610acf66ff0a548cf0ead686

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

Emacs: Revert to paredit for lisp modes.

Smartparens is nice, but isn't as nice as paredit in lispy languages,
even in strict mode.
Alan Pearce alan@alanpearce.co.uk
Sat, 11 Oct 2014 18:23:06 +0100
commit

2fd077caef472d4e610acf66ff0a548cf0ead686

parent

0959519eaa0ad9c4f0098e562da60f3bcdf01b74

2 files changed, 23 insertions(+), 2 deletions(-)

jump to
M tag-emacs/emacs.d/Casktag-emacs/emacs.d/Cask
@@ -63,6 +63,7 @@ (depends-on "org-journal") (depends-on "org-plus-contrib")
 (depends-on "pallet")
 (depends-on "paradox")
+(depends-on "paredit")
 (depends-on "persp-projectile")
 (depends-on "perspective")
 (depends-on "php-extras")
M tag-emacs/emacs.d/init.eltag-emacs/emacs.d/init.el
@@ -1057,7 +1057,26 @@ (req-package eldoc   :commands (eldoc-mode)
   :diminish eldoc-mode
   :config (progn
-            (setq eldoc-idle-delay 0.1)))
+            (setq eldoc-idle-delay 0.1)
+            (eldoc-add-command 'paredit-backward-delete 'paredit-close-round)))
+
+(req-package paredit
+  :diminish "()"
+  :commands (paredit-mode)
+  :config (progn
+            (defun ap/cedit-space-delimiter-p (endp delimiter)
+              "Don't insert a space before delimiters in c-style modes"
+              (not cedit-mode))
+            (add-to-list 'paredit-space-for-delimiter-predicates #'ap/cedit-space-delimiter-p))
+  :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)))))
 
 (req-package smartparens-config
   :config (progn
@@ -1077,7 +1096,8 @@ (bind-key "M-<down>" #'sp-splice-sexp-killing-forward sp-keymap)             (bind-key "C-M-S-k" #'sp-kill-hybrid-sexp sp-keymap)
             (bind-key "C-S-<right>" #'sp-slurp-hybrid-sexp sp-keymap)
             (show-smartparens-global-mode t)
-            (smartparens-global-strict-mode t)))
+            (smartparens-global-strict-mode t)
+            (add-hook 'lisp-mode-common-hook #'turn-off-smartparens-mode)))
 
 (req-package move-text
   :config (move-text-default-bindings))