[Python-mode] comment to signal de-indentation?

Barry Warsaw barry at python.org
Thu Feb 19 11:07:05 EST 2004


On Thu, 2004-02-19 at 10:53, Andreas Eisele wrote:

> I often move pieces of code between files and functions
> (e.g. during refactoring), and quite often, the moved
> codes need a new level of indentation.

I'm a bit pressed for time, but quickly, there are two things to look
at.  First, the variable py-honor-comment-indentation may be what you
were trying to get after with your #- comment suggestion.

Second, the real way to re-indent Python code after refactoring is by
using py-shift-region-left (C-c <) and py-shift-region-right (C-c >). 
Usually when you refactor, you're moving an entire block in or out a
level of indentation.  Just highlight the block and use these commands
to get that block at the indentation level you want.

Cheers,
-Barry





More information about the Python-mode mailing list