Feed on

to indent or dedent a block of text in emacs, first set a markpoint:


move the cursor to the end of the block, and then hit:


to indent or


to dedent.  Thanks to Chad Netzer for that hint!

Bookmark and Share

if that was helpful ...

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

7 Responses to “block indent / dedent in emacs”

  1. on 23 Aug 2007 at 9:47 am Rob Stewart

    FYI: The opposite of “indent” is “outdent,” not “dedent.”

  2. on 29 Oct 2007 at 3:07 pm Victor Trapani

    It did not work for me in putty

  3. on 04 Dec 2007 at 1:51 pm Ghen Saito

    Try this.

    Select region using C-space
    C-x-TAB to indent the region

  4. on 25 Jul 2008 at 4:05 am paan

    I’m kindda late since the last comment was in 2007 but this is just great!!

    This is way better than C-i on each line….

  5. on 07 Sep 2008 at 8:41 am wisrhvma ejlivk

    guopvzky gbkvianz frjnhzqbw fhja qwjyvcmf pengwuchq gqtchvsaj

  6. on 12 Mar 2009 at 9:53 am Mike

    Awesome, thanks!

  7. on 17 Sep 2010 at 2:37 pm Michael Daily

    Lawrence’s initial method works generally, but only in certain modes. For example, it works in python-mode but not text-mode. So the trick is to change your buffer to python-mode, do the indent using C-c + >, and then switch back to the original mode.

Did I get this wrong? Let me know!

Trackback URI | Comments RSS