Re:Two Years With Emacs as a CEO and now CTO (2018)
by yellowapple on Monday July 22, 2019 @09:23PM
(#20503730)
Basically autoindent on steroids. As one example of its niceties: if you select all text (Ctrl-X, then H; "C-x h" in Emacsese) and press Tab, it'll automatically indent the entire file (and likewise, if you select a specific region of text and press Tab, it'll auto-indent that region). It'll also auto-indent as you move to new lines (like any editor's auto-indent does, but Emacs does it a bit smarter). Also, if you press Tab mid-line, it'll indent that line (instead of sticking a tab in the middle of the line, which is usually not what you want).
For most languages, said indentation is consistent with (if not exactly complaint with) a style guide or other set of conventions. Some packages customize/alter this (for example, I use the editorconfig package to set indentation sizes and whether to use spaces/tabs by file extension, and electric indent works perfectly with those settings).
Unrelated to electric indent (but something I use in conjunction with it daily) is the ability to select a region of text and press Alt-Q ("M-q" in Emacsese) to automatically hard-wrap a long line to 80 characters. Not all languages play nicely with this, but it's really handy for comments, long arrays, and paragraphs in READMEs and other docs.
For most languages, said indentation is consistent with (if not exactly complaint with) a style guide or other set of conventions. Some packages customize/alter this (for example, I use the editorconfig package to set indentation sizes and whether to use spaces/tabs by file extension, and electric indent works perfectly with those settings).
Unrelated to electric indent (but something I use in conjunction with it daily) is the ability to select a region of text and press Alt-Q ("M-q" in Emacsese) to automatically hard-wrap a long line to 80 characters. Not all languages play nicely with this, but it's really handy for comments, long arrays, and paragraphs in READMEs and other docs.