emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] One-keystroke command to move blocks of text up and down


From: Nick Dokos
Subject: Re: [O] One-keystroke command to move blocks of text up and down
Date: Sun, 24 Feb 2013 13:16:54 -0500

Susan Cragin <address@hidden> wrote:

> From: Carsten Dominik <address@hidden>
> >On 24.2.2013, at 16:53, Susan Cragin <address@hidden> wrote:
> >
> >> I use Meta-up-arrow and Meta-down-arrow to move headings in org and 
> >> entries in spreadsheets. 
> >> Would like to be able to use the same or similar command to move blocks of 
> >> text up or down. 
> >> The current solution--highlight then kill/yank--is just too slow.
> >> Suggestions?
> >
> >Hi Susan,
> >
> >what do you mean by "blocks".  A paragraph?  Does the command
> >
> >M-x mark-paragraph
> >
> >select the right amount of text?  If so, you could try the command 
> >transpose-paragraphs.
> >
> >- Carsten
> 
> No. I have the following example. Each of these sentences is a
> paragraph because it has a carriage return after it. I need to
> re-order the sentence/paragraphs into correct order.
> 
> ** Journal
> This is paragraph three. 
> This is paragraph two. 
> This is paragraph one. 
> 
> ** Other Heading
> 

That's a "word processor" definition of a paragraph that doesn't really
work with an editor like emacs. It is more likely you will find
paragraph nirvana in emacs if you follow the TeX model where paragraphs
are separated by empty lines.  For example, there are newlines after
each line of this block of text, and an empty line separating it from
the next block of text, so emacs considers each of these blocks a
paragraph: try M-x mark-paragraph and you will see (transient-mark-mode
helps to see the boundaries).

So if you have a second paragraph like this, you can use Carsten's
suggestion of M-x transpose-paragraphs and switch them around (point has
to be somewhere in the first paragraph, including the empty line
separating it from the second for this to work).

If your "paragraphs" are single lines, as in your example, you can use
transpose-lines to move the lines around (bound to C-x C-t).

HTH,
Nick



reply via email to

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