emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Susan Cragin <susancragin@earthlink.net>
Cc: Emacs-orgmode list <emacs-orgmode@gnu.org>,
	Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: One-keystroke command to move blocks of text up and down
Date: Sun, 24 Feb 2013 13:16:54 -0500	[thread overview]
Message-ID: <9348.1361729814@alphaville> (raw)
In-Reply-To: Message from Susan Cragin <susancragin@earthlink.net> of "Sun, 24 Feb 2013 11:48:42 EST." <1670200.1361724523080.JavaMail.root@elwamui-mouette.atl.sa.earthlink.net>

Susan Cragin <susancragin@earthlink.net> wrote:

> From: Carsten Dominik <carsten.dominik@gmail.com>
> >On 24.2.2013, at 16:53, Susan Cragin <susancragin@earthlink.net> 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	other threads:[~2013-02-24 18:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-24 16:48 One-keystroke command to move blocks of text up and down Susan Cragin
2013-02-24 18:16 ` Nick Dokos [this message]
2013-02-24 18:19 ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2013-02-24 19:10 Susan Cragin
2013-02-24 20:23 ` Bastien
2013-02-24 17:13 Susan Cragin
2013-02-24 18:09 ` Bastien
2013-02-24 15:53 Susan Cragin
2013-02-24 16:16 ` Carsten Dominik
2013-02-24 16:21   ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9348.1361729814@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=susancragin@earthlink.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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