bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#2421: 23.0.90; python-mode: Indent commands behavior


From: martin rudalics
Subject: bug#2421: 23.0.90; python-mode: Indent commands behavior
Date: Thu, 05 Mar 2009 19:58:09 +0100
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

> Well, actually TAB runs indent-region.  But I need simple shift instead.
> Consider the following example:
>
>   def foo():
>       for i in range(3):
>   print i
>   print i + 1
>   print i + 2
>
> I just pasted the print lines from a differently indented code and want
> to fix the indentation by shifting the region of the print lines:
>
>   def foo():
>       for i in range(3):
>           print i
>           print i + 1
>           print i + 2
>
> TAB can't do it:
>
>   def foo():
>       for i in range(3):
>           print i
>   print i + 1
>   print i + 2

We could pass the prefix argument to `indent-region' with the semantics
that the latter ignores the mode-specific `indent-region-function' and
calls `indent-line' for each line in the region instead.

Alternatively, `python-indent-region' could, like `python-indent-line',
remember whether the last command was an `indent-for-tab-command' and
call `python-indent-line-1' with no argument for each line in the
region.  Obviously, the region would have to stay to make this
practical.  And in some pathological cases it might be hard to find the
appropriate indentation points.

Anyhow, I'm afraid that people won't approve such changes.

> To get what I want I have to press `C-8 C->'.  I don't like it, I'd like
> to call `M-x SOMETHING-shift-right' twice or
> `M-2 M-x SOMETHING-shift-right'.

That's why I earlier said that some rectangle code should handle this.

martin






reply via email to

[Prev in Thread] Current Thread [Next in Thread]