how to indent/dedent a region in emacs?

Grant Edwards grante at visi.com
Wed Jun 11 19:11:28 EDT 2008


On 2008-06-11, Alexander Schmolck <a.schmolck at gmail.com> wrote:
> Grant Edwards <grante at visi.com> writes:
>
>> I've recently switched from Jed to Emacs for editing python
>> source, and I'm still stumped as to how one indents or dedents
>> a region of code.  In Jed it's 'C-c <' or 'C-c >'.  Google has
>> found several answers, but none of them work, for example I've
>> tried bot "C-c tab" and "C-c C-r" based on postings Google has
>> found, but neither appears to actually _do_ anyting.
>
> In python-mode C-c > and C-c <  should work as well.

It does.  I'm still baffled as to how I initially convinced
myself it didn't...

> (note that you have to download python-mode.el; I don't know
> if the above also works with python.el which comes with emacs;

Yes, it does.

> C-h m will tell you which mode you're using)

I don't remember installing python-mode.el, and what comes up
when I hit C-h m matches what's in /usr/share/emacs/22.2/lisp/progmodes/python.el

> Outside python-mode, you can use string-rectangle and
> kill-rectangle, but that's inconvenient, so I've globally
> bound the below functions to these keys (you can just use the
> plain py-shift-region{-left,right} if you like them better).

Thanks, I'll make a note of those...

-- 
Grant Edwards                   grante             Yow! Why is everything made
                                  at               of Lycra Spandex?
                               visi.com            



More information about the Python-list mailing list