summaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d/init.org
diff options
context:
space:
mode:
authorGravatar Tom Willemse2015-04-21 21:27:19 +0200
committerGravatar Tom Willemse2015-04-21 21:27:47 +0200
commit6f46220968b22c191d346ec97a7bfe5204644970 (patch)
treefbd4eed3942fb7b192fe2510b4835a5a0ee0c913 /emacs/.emacs.d/init.org
parentbf669027f733d80eaf131b5bca4d7cb0a3768e7d (diff)
downloaddotfiles-6f46220968b22c191d346ec97a7bfe5204644970.tar.gz
dotfiles-6f46220968b22c191d346ec97a7bfe5204644970.zip
Give electric indent its own section
Diffstat (limited to 'emacs/.emacs.d/init.org')
-rw-r--r--emacs/.emacs.d/init.org64
1 files changed, 39 insertions, 25 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index f0314ca..5fb32b6 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -1034,12 +1034,6 @@
(add-hook 'scss-mode-hook #'electric-pair-local-mode)
#+END_SRC
- - Automatically indent code.
-
- #+BEGIN_SRC emacs-lisp
- (add-hook 'scss-mode-hook #'electric-indent-local-mode)
- #+END_SRC
-
- Enable auto-completion
#+BEGIN_SRC emacs-lisp
@@ -1094,12 +1088,6 @@
(setq ruby-align-chained-calls t)
#+END_SRC
- - Automatically indent code.
-
- #+BEGIN_SRC emacs-lisp
- (add-hook 'ruby-mode-hook #'electric-indent-local-mode)
- #+END_SRC
-
** Coffee
- Automatically match parentheses and other delimiters.
@@ -1110,12 +1098,6 @@
** PHP
- - Automatically indent code
-
- #+BEGIN_SRC emacs-lisp
- (add-hook 'php-mode-hook #'electric-indent-local-mode)
- #+END_SRC
-
*** Show tabs and spaces in indent
I'm working with some WordPress plugins nowadays and their style
@@ -1183,21 +1165,53 @@
(add-to-list 'auto-mode-alist '("\\.html\\.erb$" . web-mode)))
#+END_SRC
-** JavaScript
- Turn on electric indenting for JavaScript.
+** CSS
+
+ Turn on electric pair mode for CSS.
#+BEGIN_SRC emacs-lisp
- (add-hook 'js2-mode-hook #'electric-indent-local-mode)
+ (add-hook 'css-mode-hook #'electric-pair-local-mode)
#+END_SRC
-** CSS
-
- Turn on electric indent and electric pair modes for CSS.
+* Minor modes
+
+ Emacs offers a lot of minor modes and even more can be found in the
+ ELPA, MELPA and Marmalade repositories. These offer a lot of
+ customization possibilities and added features.
+
+** Electric indent
+
+ Automatically indenting code upon typing certain characters can be
+ very useful for certain modes where the indentation level can
+ easily be determined. One of the first things I liked about Emacs
+ was the way the {{{key(TAB)}}} key worked: It indents to the
+ "proper" level of indentation, instead of adding a tab character.
+ It quickly grew into a habit to press tab several times when
+ editing a line or a block of code. Electric indent is just an
+ extension of this that, for the most part, allows me to forget
+ about pressing tab.
+
+ It doesn't fit all modes though. When I worked in Python a lot I
+ was fighting the electric indent a lot more than it was helping me.
+ This is because instead of scope influencing indentation as in most
+ languages I've worked with, indentation determines scope in Python,
+ as anyone who's looked at it for more than a minute or two will
+ know. This means that any line can usually have several "proper"
+ indentation levels, depending on the meaning of meaning of that
+ line.
+
+ So, almost all modes use =electric-indent-local-mode=, but a few
+ don't. So I'm also very happy that recently this mode was added,
+ because =electric-indent-mode= is a global minor mode and I only want
+ to use it in some 99% of the available modes.
#+BEGIN_SRC emacs-lisp
+ (add-hook 'scss-mode-hook #'electric-indent-local-mode)
+ (add-hook 'ruby-mode-hook #'electric-indent-local-mode)
+ (add-hook 'php-mode-hook #'electric-indent-local-mode)
+ (add-hook 'js2-mode-hook #'electric-indent-local-mode)
(add-hook 'css-mode-hook #'electric-indent-local-mode)
- (add-hook 'css-mode-hook #'electric-pair-local-mode)
#+END_SRC
* Load custom file