Feed on
Posts
Comments

one of the reasons why i use emacs, as opposed to just a vanilla text editor, is that it auto-indents your code. all you’ve got to do is ask it to do so nicely.

just highlight the region of code you want indented (control-space at the beginning of the text block, then move the blinking cursor to the end of the text block) and hit:

>> C-M-\

or, “control-meta-backslash.”

Stumble it!

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

3 Responses to “how to auto-indent in emacs”

  1. on 23 Sep 2007 at 9:23 am x

    Not always working, maybe i’m dull on this …
    Ctrl+M just gives a newline, before hitting \

  2. on 27 Sep 2007 at 6:44 pm y

    It’s not control + M (as in shift+m) it’s control + meta, usually alt or escape. So, depending on your settings it might be control+alt+\

  3. on 20 Jan 2008 at 8:05 am noshir

    thank you

    and thank you emacs so nice this auto indent

Did I get this wrong? Let me know!

Trackback URI | Comments RSS

More blogs about http://desk.stinkpot.org:8080/tricks.