Emacs: migrate expressions from ap/lisp-setup to lisp-common-mode-hook where possible
Alan Pearce alan@alanpearce.co.uk
Sat, 08 Jun 2013 13:46:11 +0100
1 files changed, 20 insertions(+), 15 deletions(-)
jump to
M emacs/init.el → emacs/init.el
@@ -446,7 +446,10 @@ auto-indent-assign-indent-level 4 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 @@ ace-jump-mode-scope 'window))) (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 @@ ("M-<f3>" . mc/mark-all-like-this-dwim) ("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 @@ ;;;; 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 @@ run-geiser 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