Aggressive Auto-indentation28 Sep 2014, by Artur Malabarba.
Emacs.SE Lessons post series
electric-indent-mode is enough to keep your code nicely
aligned when all you do is type. However, once you start shifting
blocks around, transposing lines, or slurping and barfing sexps,
indentation is bound to go wrong.
So long as you have Melpa configured, you can install it with.
Then simply turn it on and you’ll never have unindented code again.
This will activate
aggressive-indent-mode on every non-text buffer. If you're
a little shy, you can also turn it on only for specific major modes by using
Here’s some code to try it on. After you’ve evaluated the above, open a new “.el” file, paste the following code, and type something before the opening parentheses.
Announce new package!