summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2013-06-08 13:46:11 +0100
committerAlan Pearce2013-06-08 13:46:11 +0100
commitc69634f046284580989ae7c7cd6705bbd0f2b243 (patch)
tree3e5f62480304907b21377c434f2117ce7cd150d7
parent840c6f683c5fa5f41b95d254e3a87aa245630160 (diff)
downloadnixfiles-c69634f046284580989ae7c7cd6705bbd0f2b243.tar.lz
nixfiles-c69634f046284580989ae7c7cd6705bbd0f2b243.tar.zst
nixfiles-c69634f046284580989ae7c7cd6705bbd0f2b243.zip
Emacs: migrate expressions from ap/lisp-setup to lisp-common-mode-hook where possible
-rw-r--r--emacs/init.el35
1 files changed, 20 insertions, 15 deletions
diff --git a/emacs/init.el b/emacs/init.el
index 6a370309..641cdc29 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -446,7 +446,10 @@ Values: `desktop', `server', `laptop'")
                   auto-indent-backward-delete-char-behavior nil
                   auto-indent-delete-trailing-whitespace-on-save-file t
                   auto-indent-mode-untabify-on-yank-or-paste nil)
-            (auto-indent-global-mode)))
+            (auto-indent-global-mode)
+            (defun lisp-auto-indent-mode ()
+              (set (make-local-variable 'auto-indent-assign-indent-level) 2))
+            (add-hook 'lisp-common-mode-hook #'lisp-auto-indent-mode)))
 
 (use-package smart-tabs-mode
   :ensure t
@@ -815,9 +818,13 @@ Also returns nil if pid is nil."
 
 (use-package autopair
   :ensure t
-  :commands (autopair-mode)
+  :commands (autopair-mode
+             autopair-on)
   :init (progn
-          (add-hook 'prog-mode-hook #'autopair-mode)
+          (add-hook 'prog-mode-hook #'autopair-on)
+          (defun autopair-off ()
+            (autopair-mode -1))
+          (add-hook 'lisp-common-mode-hook #'autopair-off)
           (setq autopair-blink nil
                 autopair-skip-whitespace nil)))
 
@@ -836,10 +843,16 @@ Also returns nil if pid is nil."
          ("C-<f3>" . mc/mark-more-like-this-extended)
          ("C-S-L" . mc/edit-lines)))
 
+(use-package eldoc
+  :defuns (eldoc-add-command)
+  :config (progn
+            (eldoc-add-command 'paredit-backward-delete 'paredit-close-round)))
+
 (use-package paredit
   :ensure t
   :commands (paredit-mode)
   :init (progn
+          (add-hook 'lisp-common-mode-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)
@@ -878,17 +891,7 @@ Also returns nil if pid is nil."
 ;;;; Lisps
 
 (defun ap/lisp-setup ()
-  (if (featurep 'autopair)
-      (autopair-mode -1))
-  (paredit-mode +1)
-  (if (featurep 'redshank)
-	  (redshank-mode +1))
-  (eldoc-add-command 'paredit-backward-delete 'paredit-close-round)
-
-  (if (featurep 'auto-indent-mode)
-      (progn (set (make-local-variable 'auto-indent-assign-indent-level) 2)
-             (auto-indent-mode +1)))
-
+  (run-hooks 'lisp-common-mode-hook)
   (show-paren-mode t)
   (setq indent-tabs-mode nil)
   (local-set-key (kbd "RET") #'paredit-newline))
@@ -914,7 +917,9 @@ Also returns nil if pid is nil."
              run-racket))
 
 (use-package redshank
-  :ensure t)
+  :ensure t
+  :init (progn
+          (add-hook 'lisp-common-mode-hook #'turn-on-redshank-mode)))
 
 (use-package geiser-base
   :defer t