From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: One-keystroke command to move blocks of text up and down Date: Sun, 24 Feb 2013 13:16:54 -0500 Message-ID: <9348.1361729814@alphaville> References: <1670200.1361724523080.JavaMail.root@elwamui-mouette.atl.sa.earthlink.net> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:52962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9g8L-0004uj-Bq for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 13:17:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9g89-0007x7-2N for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 13:17:09 -0500 Received: from g1t0029.austin.hp.com ([15.216.28.36]:25244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9g88-0007wh-QY for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 13:16:56 -0500 In-Reply-To: Message from Susan Cragin of "Sun, 24 Feb 2013 11:48:42 EST." <1670200.1361724523080.JavaMail.root@elwamui-mouette.atl.sa.earthlink.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Susan Cragin Cc: Emacs-orgmode list , Carsten Dominik Susan Cragin wrote: > From: Carsten Dominik > >On 24.2.2013, at 16:53, Susan Cragin 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