about summary refs log tree commit diff stats
path: root/.emacs.d/lisp/init-paredit.el
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2021-08-17 12:49:19 +0100
committerDavid Morgan <djm_uk@protonmail.com>2021-08-17 12:49:19 +0100
commitd0db5660caa836755ea8c99471d816484ea9e837 (patch)
treec7d0456a58e450abaf34b489b0b31c58ddbc8557 /.emacs.d/lisp/init-paredit.el
parentc92b18514728245850d31531ce224a74eddfc5a6 (diff)
downloaddotfiles-d0db5660caa836755ea8c99471d816484ea9e837.tar.gz
Add new .emacs.d
Diffstat (limited to '.emacs.d/lisp/init-paredit.el')
-rw-r--r--.emacs.d/lisp/init-paredit.el35
1 files changed, 35 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-paredit.el b/.emacs.d/lisp/init-paredit.el
new file mode 100644
index 0000000..20dc2da
--- /dev/null
+++ b/.emacs.d/lisp/init-paredit.el
@@ -0,0 +1,35 @@
+;;; init-paredit.el --- Paredit Configuration File -*- lexical-binding: t -*-
+;;; Commentary:
+;; add-hooks/add-lisp-hook based on https://github.com/bodil/emacs.d/blob/master/bodil/bodil-lisp.el
+;;; Code:
+
+(defun add-hooks (modes func)
+ (dolist (mode modes)
+  (add-hook (intern (concat (symbol-name mode) "-hook")) func)))
+
+(setq lisp-modes
+ '(scheme-mode emacs-lisp-mode lisp-mode clojure-mode cider-repl-mode
+   eval-expression-minibuffer-setup ielm-mode lisp-interaction-mode))
+
+(defun add-lisp-hook (func)
+  (add-hooks lisp-modes func))
+
+(use-package paredit
+  :diminish
+  ;; sp does a few things better
+  :bind (([remap mark-sexp] . sp-mark-sexp)
+         ("M-[" . sp-wrap-square)
+         ("C-c M-{" . sp-wrap-curly)
+         ([remap paredit-wrap-round] . sp-wrap-round)
+         ([remap paredit-meta-doublequote] . sp-wrap-double-quotation-marks)
+         ("M-W" . paredit-copy-as-kill))
+  :config
+  (defun sp-wrap-double-quotation-marks ()
+    (interactive)
+    (sp-wrap-with-pair "\""))
+  :init
+  (add-lisp-hook #'turn-off-smartparens-mode)
+  (add-lisp-hook #'enable-paredit-mode))
+
+(provide 'init-paredit)
+;;; init-paredit.el ends here