diff options
author | rekado <rekado@elephly.net> | 2016-12-11 12:44:15 +0100 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2016-12-11 12:44:15 +0100 |
commit | 226064804f9b8dbe5c46703b0ffb5e3851f78aaa (patch) | |
tree | 88eb49971375daa11fa62d034317c19652c9d196 /init.org | |
parent | dff4bc8aed0ba0f672750c3b4a39b725a13bbc03 (diff) |
Move paredit config to init.org.
Diffstat (limited to 'init.org')
-rw-r--r-- | init.org | 34 |
1 files changed, 33 insertions, 1 deletions
@@ -801,6 +801,39 @@ Emacs also highlights matching parentheses, but it does so with a delay. Here I (show-paren-mode 1) #+END_SRC +Editing lispy languages is no fun without =paredit=, a mode to enforce balanced parentheses. Enable it automatically when editing Scheme or Elisp. + +#+BEGIN_SRC elisp +(add-hook 'scheme-mode-hook (lambda () (paredit-mode 1))) +(add-hook 'emacs-lisp-mode-hook (lambda () (paredit-mode 1))) +(add-hook 'geiser-repl-mode-hook (lambda () (paredit-mode 1))) +#+END_SRC + +Also enable =paredit= when editing Elisp in the minibuffer. + +#+BEGIN_SRC elisp +;; Enable `paredit-mode' in the minibuffer, during `eval-expression'. +(defun conditionally-enable-paredit-mode () + (if (eq this-command 'eval-expression) + (paredit-mode 1))) + +(add-hook 'minibuffer-setup-hook 'conditionally-enable-paredit-mode) +#+END_SRC + +Some customisations for =paredit=. + +#+BEGIN_SRC elisp +(with-eval-after-load "paredit" + ;; don't hijack \ please + (define-key paredit-mode-map (kbd "\\") nil) + ;; keybindings + (define-key paredit-mode-map (kbd "M-C-<backspace>") 'backward-kill-sexp) + ;; making paredit work with delete-selection-mode + (put 'paredit-forward-delete 'delete-selection 'supersede) + (put 'paredit-backward-delete 'delete-selection 'supersede) + (put 'paredit-newline 'delete-selection t)) +#+END_SRC + TODO: the parentheses adjustments should happen only when I’m in programming mode. #+BEGIN_SRC elisp @@ -1023,7 +1056,6 @@ This is even more stuff to be done after initialising packages. I still need to (load "init-eshell.el") (load "init-modeline.el") (load "init-my-stuff.el") -(load "init-paredit.el") ;; Revert stale document graphics buffers automatically when the files ;; have changed. |