unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs block indentation
@ 2009-09-30  7:12 Jaideep Das
  2009-09-30 18:25 ` Andreas Röhler
  0 siblings, 1 reply; 9+ messages in thread
From: Jaideep Das @ 2009-09-30  7:12 UTC (permalink / raw)
  To: Help-gnu-emacs


I am using emacs 2.2 at work and 2.3 at home for python coding. I want to
know how can I indent or outdent a block of code multiple times. When I mean
is when I select a code part using C-space and then use C-x <tab> / C-c-> /
C-c-< to indent or outdent, this only works once and then deselect the
block. What if i want to indent multiple times on the same code block do I
have to repeated this key sequence from selecting the block to indent.
-- 
View this message in context: http://www.nabble.com/Emacs-block-indentation-tp25676078p25676078.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Emacs block indentation
       [not found] <mailman.7750.1254298777.2239.help-gnu-emacs@gnu.org>
@ 2009-09-30 13:56 ` John A Pershing Jr
  2009-10-03 12:41   ` Jaideep Das
       [not found]   ` <mailman.7931.1254573694.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: John A Pershing Jr @ 2009-09-30 13:56 UTC (permalink / raw)
  To: help-gnu-emacs

Jaideep Das <jaideep.jdof@gmail.com> writes:
> I am using emacs 2.2 at work and 2.3 at home for python coding. I want
> to know how can I indent or outdent a block of code multiple times. When
> I mean is when I select a code part using C-space and then use C-x <tab>
> / C-c-> / C-c-< to indent or outdent, this only works once and then
> deselect the block. What if i want to indent multiple times on the same
> code block do I have to repeated this key sequence from selecting the
> block to indent.

No, the region has not been deselected.  All that has happened is that
the "active" flag has been cleared.  The indent/outdent functions ignore
the "active" flag.

  -jp


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Emacs block indentation
       [not found] <mailman.7751.1254298784.2239.help-gnu-emacs@gnu.org>
@ 2009-09-30 14:03 ` Miles Bader
  2009-09-30 17:26   ` Jaideep Das
  2009-10-18  1:03   ` David Combs
  0 siblings, 2 replies; 9+ messages in thread
From: Miles Bader @ 2009-09-30 14:03 UTC (permalink / raw)
  To: help-gnu-emacs

Jaideep Das <jaideep.jdof@gmail.com> writes:
> is when I select a code part using C-space and then use C-x <tab> / C-c-> /
> C-c-< to indent or outdent, this only works once and then deselect the
> block. What if i want to indent multiple times on the same code block do I
> have to repeated this key sequence from selecting the block to indent.

You might try the "C-x z" command, which means "repeat previous
command".

-Miles

-- 
`...the Soviet Union was sliding in to an economic collapse so comprehensive
 that in the end its factories produced not goods but bads: finished products
 less valuable than the raw materials they were made from.'  [The Economist]


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Emacs block indentation
  2009-09-30 14:03 ` Miles Bader
@ 2009-09-30 17:26   ` Jaideep Das
  2009-10-18  1:03   ` David Combs
  1 sibling, 0 replies; 9+ messages in thread
From: Jaideep Das @ 2009-09-30 17:26 UTC (permalink / raw)
  To: Help-gnu-emacs




Miles Bader-2 wrote:
> 
> Jaideep Das <jaideep.jdof@gmail.com> writes:
>> is when I select a code part using C-space and then use C-x <tab> / C-c->
>> /
>> C-c-< to indent or outdent, this only works once and then deselect the
>> block. What if i want to indent multiple times on the same code block do
>> I
>> have to repeated this key sequence from selecting the block to indent.
> 
> You might try the "C-x z" command, which means "repeat previous
> command".
> 
> -Miles
> 
> -- 
> `...the Soviet Union was sliding in to an economic collapse so
> comprehensive
>  that in the end its factories produced not goods but bads: finished
> products
>  less valuable than the raw materials they were made from.'  [The
> Economist]
> 

This is exactly what I was looking for Thanks.
-- 
View this message in context: http://www.nabble.com/Emacs-block-indentation-tp25676078p25685440.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Emacs block indentation
  2009-09-30  7:12 Jaideep Das
@ 2009-09-30 18:25 ` Andreas Röhler
  0 siblings, 0 replies; 9+ messages in thread
From: Andreas Röhler @ 2009-09-30 18:25 UTC (permalink / raw)
  To: Jaideep Das; +Cc: help-gnu-emacs, python-mode

Jaideep Das wrote:
> I am using emacs 2.2 at work and 2.3 at home for python coding. I want to
> know how can I indent or outdent a block of code multiple times. What I mean
> is when I select a code part using C-space and then use C-x <tab> / C-c-> /
> C-c-< to indent or outdent, this only works once and then deselect the
> block. What if i want to indent multiple times on the same code block do I
> have to repeated this key sequence from selecting the block to indent.
>   

Commit message of latest revision of python-mode.el (note: not
python.el) says:

"When shifting regions right and left, keep the region active in Emacs."

This might solve your problem.

Get it at

https://code.launchpad.net/~python-mode-devs/python-mode/python-mode

or with
 
bzr branch lp:python-mode

HTH

Andreas

--
https://code.launchpad.net/s-x-emacs-werkstatt/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Emacs block indentation
  2009-09-30 13:56 ` Emacs block indentation John A Pershing Jr
@ 2009-10-03 12:41   ` Jaideep Das
       [not found]   ` <mailman.7931.1254573694.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Jaideep Das @ 2009-10-03 12:41 UTC (permalink / raw)
  To: Help-gnu-emacs




John A Pershing Jr wrote:
> 
> Jaideep Das <jaideep.jdof@gmail.com> writes:
>> I am using emacs 2.2 at work and 2.3 at home for python coding. I want
>> to know how can I indent or outdent a block of code multiple times. When
>> I mean is when I select a code part using C-space and then use C-x <tab>
>> / C-c-> / C-c-< to indent or outdent, this only works once and then
>> deselect the block. What if i want to indent multiple times on the same
>> code block do I have to repeated this key sequence from selecting the
>> block to indent.
> 
> No, the region has not been deselected.  All that has happened is that
> the "active" flag has been cleared.  The indent/outdent functions ignore
> the "active" flag.
> 
>   -jp
> 
> 

How do you reactivate the region.
-- 
View this message in context: http://www.nabble.com/Emacs-block-indentation-tp25676078p25728394.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Emacs block indentation
       [not found]   ` <mailman.7931.1254573694.2239.help-gnu-emacs@gnu.org>
@ 2009-10-03 19:32     ` John A Pershing Jr
  2009-10-18  0:56       ` David Combs
  0 siblings, 1 reply; 9+ messages in thread
From: John A Pershing Jr @ 2009-10-03 19:32 UTC (permalink / raw)
  To: help-gnu-emacs

Jaideep Das <jaideep.jdof@gmail.com> writes:

> John A Pershing Jr wrote:

>>  No, the region has not been deselected.  All that has happened is
>> that the "active" flag has been cleared.  The indent/outdent functions
>> ignore the "active" flag.

> How do you reactivate the region.

Exchanging point and mark (C-x C-x, by default) will reactivate the
region.  However, unless you are invoking a function that behaves
differently depending on whether the region is active or not, you
generally don't have to do this.  For instance, in your previous query
about repeatedly in/outdenting the region, it doesn't matter whether the
region is "active" -- it will still get in/outdented.

[I'm beginning to think it was a mistake to turn on transient mark mode
by default; it seems to be generating more confusion than it is worth.]

  -jp


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Emacs block indentation
  2009-10-03 19:32     ` John A Pershing Jr
@ 2009-10-18  0:56       ` David Combs
  0 siblings, 0 replies; 9+ messages in thread
From: David Combs @ 2009-10-18  0:56 UTC (permalink / raw)
  To: help-gnu-emacs

In article <82iqeww9wf.fsf@alum.mit.edu>,
John A Pershing Jr  <pershing@alum.mit.edu> wrote:
>Jaideep Das <jaideep.jdof@gmail.com> writes:
>
>> John A Pershing Jr wrote:
>
>>>  No, the region has not been deselected.  All that has happened is
>>> that the "active" flag has been cleared.  The indent/outdent functions
>>> ignore the "active" flag.
>
>> How do you reactivate the region.
>
>Exchanging point and mark (C-x C-x, by default) will reactivate the
>region.  However, unless you are invoking a function that behaves
>differently depending on whether the region is active or not, you
>generally don't have to do this.  For instance, in your previous query
>about repeatedly in/outdenting the region, it doesn't matter whether the
>region is "active" -- it will still get in/outdented.
>
>[I'm beginning to think it was a mistake to turn on transient mark mode
>by default; it seems to be generating more confusion than it is worth.]
>
>  -jp

Someone please comment on that final sentence, re transient-mark-mode.

Thanks!

David




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Emacs block indentation
  2009-09-30 14:03 ` Miles Bader
  2009-09-30 17:26   ` Jaideep Das
@ 2009-10-18  1:03   ` David Combs
  1 sibling, 0 replies; 9+ messages in thread
From: David Combs @ 2009-10-18  1:03 UTC (permalink / raw)
  To: help-gnu-emacs

In article <8763b0jzqz.fsf@catnip.gol.com>, Miles Bader  <miles@gnu.org> wrote:
>Jaideep Das <jaideep.jdof@gmail.com> writes:
>> is when I select a code part using C-space and then use C-x <tab> / C-c-> /
>> C-c-< to indent or outdent, this only works once and then deselect the
>> block. What if i want to indent multiple times on the same code block do I
>> have to repeated this key sequence from selecting the block to indent.
>
>You might try the "C-x z" command, which means "repeat previous
>command".
>
>-Miles

Hmmm.  Nice, I guess.  First I've heard of it.

So I guess I should include this for possible elaboration?



C-x z runs the command repeat
  which is an interactive autoloaded Lisp function in `repeat'.
It is bound to C-x z.
(repeat repeat-arg)

Repeat most recently executed command.
With prefix arg, apply new prefix arg to that command; otherwise, use
the prefix arg that was used before (if any).
This command is like the `.' command in the vi editor.

If this command is invoked by a multi-character key sequence, it can then
be repeated by repeating the final character of that sequence.  This behavior
can be modified by the global variable `repeat-on-final-keystroke'.



C-x ESC ESC (translated from C-x <escape> <escape>) runs the command repeat-complex-command
  which is an interactive compiled Lisp function in `simple.el'.
It is bound to <redo>, <again>, C-x M-ESC, C-x M-:.
(repeat-complex-command arg)

Edit and re-evaluate last complex command, or argth from last.
A complex command is one which used the minibuffer.
The command is placed in the minibuffer as a Lisp form for editing.
The result is executed, repeating the command as changed.
If the command has been changed or is not the most recent previous command
it is added to the front of the command history.
You can use the minibuffer history commands M-n and M-p
to get different commands to edit and resubmit.




Thanks,

David

PS: Maybe someone could send a msg to rms to make sure that these two
appear together in the manual?





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-10-18  1:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.7750.1254298777.2239.help-gnu-emacs@gnu.org>
2009-09-30 13:56 ` Emacs block indentation John A Pershing Jr
2009-10-03 12:41   ` Jaideep Das
     [not found]   ` <mailman.7931.1254573694.2239.help-gnu-emacs@gnu.org>
2009-10-03 19:32     ` John A Pershing Jr
2009-10-18  0:56       ` David Combs
     [not found] <mailman.7751.1254298784.2239.help-gnu-emacs@gnu.org>
2009-09-30 14:03 ` Miles Bader
2009-09-30 17:26   ` Jaideep Das
2009-10-18  1:03   ` David Combs
2009-09-30  7:12 Jaideep Das
2009-09-30 18:25 ` Andreas Röhler

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).