Remove unnecessary custom minor mode

This commit is contained in:
Tom Willemse 2015-04-20 01:03:18 +02:00
parent fd5b2c2cdf
commit 6e1dace32b

View file

@ -1042,30 +1042,6 @@
(local-unset-key (kbd "RET")))))
#+END_SRC
* Local minor mode for =electric-pair-mode=
Almost all modes benefit from automatic delimiter pairing, but not
all modes are equal. =paredit= works awesomely for anything lisp-like,
but not so much for other modes, that's where =electric-pair-mode=
comes in. Unfortunately it has no local version, so I copied the
code from =electric-indent-local-mode= and changed it work with
=electric-pair-mode=.
#+BEGIN_SRC emacs-lisp
;; Copied from electric.el, modified from `electric-indent-local-mode'.
(define-minor-mode oni:electric-pair-local-mode
"Toggle `electric-pair-mode' only in this buffer."
:variable (buffer-local-value 'electric-pair-mode (current-buffer))
(cond
((eq electric-pair-mode (default-value 'electric-pair-mode))
(kill-local-variable 'electric-pair-mode))
((not (default-value 'electric-pair-mode))
;; Locally enabled, but globally disabled.
(electric-pair-mode 1) ; Setup the hooks.
(setq-default electric-pair-mode nil) ; But keep it globally disabled.
)))
#+END_SRC
* Remove whitespace when closing delimiters
In =electric-pair-mode=, skip over and delete white space if it stands