summary refs log tree commit diff stats
path: root/tag-emacs
diff options
context:
space:
mode:
authorAlan Pearce2014-10-11 18:23:06 +0100
committerAlan Pearce2014-10-11 18:23:06 +0100
commit2fd077caef472d4e610acf66ff0a548cf0ead686 (patch)
tree82d2e8300e09851658b1d9a1a1c87e027a280992 /tag-emacs
parent0959519eaa0ad9c4f0098e562da60f3bcdf01b74 (diff)
downloaddotfiles-2fd077caef472d4e610acf66ff0a548cf0ead686.tar.lz
dotfiles-2fd077caef472d4e610acf66ff0a548cf0ead686.tar.zst
dotfiles-2fd077caef472d4e610acf66ff0a548cf0ead686.zip
Emacs: Revert to paredit for lisp modes.
Smartparens is nice, but isn't as nice as paredit in lispy languages,
even in strict mode.
Diffstat (limited to 'tag-emacs')
-rw-r--r--tag-emacs/emacs.d/Cask1
-rw-r--r--tag-emacs/emacs.d/init.el24
2 files changed, 23 insertions, 2 deletions
diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask
index 1a65cc3..4809547 100644
--- a/tag-emacs/emacs.d/Cask
+++ b/tag-emacs/emacs.d/Cask
@@ -63,6 +63,7 @@
 (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")
diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el
index 051d298..120c85b 100644
--- a/tag-emacs/emacs.d/init.el
+++ b/tag-emacs/emacs.d/init.el
@@ -1057,7 +1057,26 @@ mouse-1: Display Line and Column Mode Menu"))))))
   :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 @@ mouse-1: Display Line and Column Mode Menu"))))))
             (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))