* Python indent region
@ 2006-07-10 10:49 Shug Boabby
2006-07-10 11:12 ` Wolfram Kraus
0 siblings, 1 reply; 4+ messages in thread
From: Shug Boabby @ 2006-07-10 10:49 UTC (permalink / raw)
Hello all,
As you may know, python recognises blocks of code by their indentation
level. Emacs handles this very well when writing code. However, Emacs
does not handle indenting/unindenting whole regions very well.
I was wondering if somebody could please write me some lisp code that
would add 4 spaces (or the user defined indent character) to the
beginning of each line in a region, and a complementary function to
reduce each line in a region by one indentation level. These would
really help out when doing some code restructuring in Python.
Thanks,
Shug
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Python indent region
2006-07-10 10:49 Python indent region Shug Boabby
@ 2006-07-10 11:12 ` Wolfram Kraus
2006-07-10 19:15 ` Peter Dyballa
[not found] ` <mailman.3945.1152558917.9609.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 4+ messages in thread
From: Wolfram Kraus @ 2006-07-10 11:12 UTC (permalink / raw)
On 10.07.2006 12:49, Shug Boabby wrote:
> Hello all,
>
> As you may know, python recognises blocks of code by their indentation
> level. Emacs handles this very well when writing code. However, Emacs
> does not handle indenting/unindenting whole regions very well.
>
> I was wondering if somebody could please write me some lisp code that
> would add 4 spaces (or the user defined indent character) to the
> beginning of each line in a region, and a complementary function to
> reduce each line in a region by one indentation level. These would
> really help out when doing some code restructuring in Python.
>
> Thanks,
> Shug
>
In Python-mode
C-c <
C-c >
should do what you want
HTH,
Wolfram
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Python indent region
2006-07-10 11:12 ` Wolfram Kraus
@ 2006-07-10 19:15 ` Peter Dyballa
[not found] ` <mailman.3945.1152558917.9609.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2006-07-10 19:15 UTC (permalink / raw)
Cc: help-gnu-emacs
Am 10.07.2006 um 13:12 schrieb Wolfram Kraus:
> In Python-mode
> C-c <
> C-c >
> should do what you want
And if these do not do it you can use rectangle functions to cut out
a block of so many lines height and these few columns width, or
"open" the marked lines by inserting as many spaces as the mark
indicates or a particular string.
--
Greetings
Pete
~ o
~_\\_/\
~ O O
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Python indent region
[not found] ` <mailman.3945.1152558917.9609.help-gnu-emacs@gnu.org>
@ 2006-07-11 9:08 ` Mathias Dahl
0 siblings, 0 replies; 4+ messages in thread
From: Mathias Dahl @ 2006-07-11 9:08 UTC (permalink / raw)
Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> And if these do not do it you can use rectangle functions to cut out
> a block of so many lines height and these few columns width, or
> "open" the marked lines by inserting as many spaces as the mark
> indicates or a particular string.
For example C-x r o (open rectangle). You can also use C-x r t STRING
to prefix a rectangle with a string.
And, finally, you can also use C-x TAB to indent region one space at a
time. With a prefix argument you can control the number of spaces and
you can even enter a negative argument to decrease the indentation.
I think you should have enough options now :)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-07-11 9:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-10 10:49 Python indent region Shug Boabby
2006-07-10 11:12 ` Wolfram Kraus
2006-07-10 19:15 ` Peter Dyballa
[not found] ` <mailman.3945.1152558917.9609.help-gnu-emacs@gnu.org>
2006-07-11 9:08 ` Mathias Dahl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).