Cycling through indentations (for a region )

Asked by James Jong

Is there a way to have Python-mode cycle through possible indentations for a full region?

e.g. say I have:

if condition:
     something

     something_else_1
     something_else_2
     something_else_3

There are two possible indentations for the last three lines (inside or outside the if statement). I would like to cycle through the these two possible indentations when I have the last three lines selected. Is this possible in python-mode?

Question information

Language:
English Edit question
Status:
Answered
For:
python-mode.el Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andreas Roehler (a-roehler) said :
#1

Am 31.01.2013 20:35, schrieb James Jong:
> New question #220690 on python-mode.el:
> https://answers.launchpad.net/python-mode/+question/220690
>
> Is there a way to have Python-mode cycle through possible indentations for a full region?
>
>
> e.g. say I have:
>
> if condition:
> something
>
> something_else_1
> something_else_2
> something_else_3
>
> There are two possible indentations for the last three lines (inside or outside the if statement). I would like to cycle through the these two possible indentations when I have the last three lines selected. Is this possible in python-mode?
>

M-x customize-variable RET py-tab-shifts-region-p

Setting it to `t' should do it

Can you help with this problem?

Provide an answer of your own, or ask James Jong for more information if necessary.

To post a message you must log in.