From b28d3ff3f2cb4d38580693e93a86a0205b7927f1 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 21 Apr 2015 21:40:14 +0200 Subject: Add section about electric pairing --- emacs/.emacs.d/init.org | 64 +++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 34 deletions(-) (limited to 'emacs/.emacs.d/init.org') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 5fb32b6..6c53232 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1028,12 +1028,6 @@ ** SCSS - - Automatically match parentheses and other delimiters. - - #+BEGIN_SRC emacs-lisp - (add-hook 'scss-mode-hook #'electric-pair-local-mode) - #+END_SRC - - Enable auto-completion #+BEGIN_SRC emacs-lisp @@ -1052,12 +1046,6 @@ ** Haml - - Automatically match parentheses and other delimiters. - - #+BEGIN_SRC emacs-lisp - (add-hook 'haml-mode-hook #'electric-pair-local-mode) - #+END_SRC - - Check syntax on the fly #+BEGIN_SRC emacs-lisp @@ -1068,12 +1056,6 @@ ** Ruby - - Automatically match parentheses and other delimiters. - - #+BEGIN_SRC emacs-lisp - (add-hook 'ruby-mode-hook #'electric-pair-local-mode) - #+END_SRC - - Enable flycheck #+BEGIN_SRC emacs-lisp @@ -1088,14 +1070,6 @@ (setq ruby-align-chained-calls t) #+END_SRC -** Coffee - - - Automatically match parentheses and other delimiters. - - #+BEGIN_SRC emacs-lisp - (add-hook 'coffee-mode-hook #'electric-pair-local-mode) - #+END_SRC - ** PHP *** Show tabs and spaces in indent @@ -1166,14 +1140,6 @@ #+END_SRC -** CSS - - Turn on electric pair mode for CSS. - - #+BEGIN_SRC emacs-lisp - (add-hook 'css-mode-hook #'electric-pair-local-mode) - #+END_SRC - * Minor modes Emacs offers a lot of minor modes and even more can be found in the @@ -1214,6 +1180,36 @@ (add-hook 'css-mode-hook #'electric-indent-local-mode) #+END_SRC +** Electric pairing + + Electric pairing of delimiters is one of those features that is + just so essential to my feeling comfortable with an editor. Most of + the time I don't even use it, really. It's just that I'm so used to + having it and when I /do/ expect it to be there it is so frustrating + when it's not, or when it doesn't work properly. + + This functionality, much like [[Electric indent]] isn't something I + want enabled in all modes, though for different reasons, and for a + time there was only the global =electric-pair-mode=. Again I'm very + happy that a local version was added. + + The reason that I don't want it enabled for all modes is that some + modes (mostly Lisp-like language modes) have better alternatives. + But most non-Lisp-like language modes I really do need to have it. + + #+BEGIN_SRC emacs-lisp + (add-hook 'c-mode-hook #'electric-pair-local-mode) + (add-hook 'coffee-mode-hook #'electric-pair-local-mode) + (add-hook 'css-mode-hook #'electric-pair-local-mode) + (add-hook 'haml-mode-hook #'electric-pair-local-mode) + (add-hook 'java-mode-hook #'electric-pair-local-mode) + (add-hook 'js2-mode-hook #'electric-pair-local-mode) + (add-hook 'lua-mode-hook #'electric-pair-local-mode) + (add-hook 'python-mode-hook #'electric-pair-local-mode) + (add-hook 'ruby-mode-hook #'electric-pair-local-mode) + (add-hook 'scss-mode-hook #'electric-pair-local-mode) + #+END_SRC + * Load custom file I don't really use the Emacs customization interface much, but I -- cgit v1.2.3-54-g00ecf