Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In some modes (e.g. C mode, plain text mode, several others), yes, though it's usually turned off by default. (I find it really distracting.) Usually, it automatically indents when you type a newline, add an opening or closing brace, an if statement, etc. The re-indent-as-you-go behavior seems to be used most in C mode, because you can specifically configure your indent style (http://en.wikipedia.org/wiki/Indent_style).

Most modes also have a command such as c-fill-paragraph that re-indents the chunk of code (e.g. function body) that the cursor is in. (Emacs refers to this behavior as "filling", so that's what to search for.) I think people use this pretty often - it's alt-Q by default.

The automatic indentation is quite good for some modes (C, Lisps in general, Python, OCaml, Lua, probably many others), but not always perfect (haskell-mode comes to mind). I think the important thing is that Emacs provides a lot of hooks for building mode-specific indentation-control functions and is not terribly difficult to extend.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: