From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: harven Newsgroups: gmane.emacs.help Subject: Re: Move selection up, down Date: Tue, 19 Aug 2008 14:27:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: <67d8af01-dce7-42e3-9a00-c4c5f3565469@d1g2000hsg.googlegroups.com> References: <1422fa24-05d5-436b-82e2-b436af0a00a3@m3g2000hsc.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1219182055 902 80.91.229.12 (19 Aug 2008 21:40:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Aug 2008 21:40:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 19 23:41:48 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KVYxM-0004w6-9b for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Aug 2008 23:41:37 +0200 Original-Received: from localhost ([127.0.0.1]:54613 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVYwO-00054O-4d for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Aug 2008 17:40:36 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!d1g2000hsg.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 41 Original-NNTP-Posting-Host: 82.240.200.149 Original-X-Trace: posting.google.com 1219181232 2298 127.0.0.1 (19 Aug 2008 21:27:12 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 19 Aug 2008 21:27:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d1g2000hsg.googlegroups.com; posting-host=82.240.200.149; posting-account=hanW0AoAAADuR-PIr5jGeb298Y3jGR7p User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:161448 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56795 Archived-At: On Aug 19, 4:21=A0pm, "jiri.pejc...@gmail.com" wrote: > Hi, > > in Netbeans when you press M-S-up/M-S-down you move the selected text > up/down. When nothing is selected it moves the current line. > > With C-S-up/C-S-down you copy the selection up/down. When nothings is > selected it copies the current line up/down. > > Is such functionality available in emacs? > > Jiri Pejchal There are similar functionalities in emacs, although the bindings are different. For example, the command that transposes two consecutive lines is called transpose-lines and is bound to C-x C-t by default. Other transpose commands include transpose-region, transpose- char, transpose-paragraphs, transpose-words, transpose-sentences. You can also redefine such functionalities by hand using a bit of lisp code. For example, if I want to exchange two consecutive lines, I can define the following command: (defun line-down () (interactive) (save-excursion (beginning-of-line) (kill-line 1) (next-line) (yank)) (next-line)) and bind it to C-S-down: (global-set-key (kbd "C-S-") 'line-down) This may convince you that new functionalities are easily added to emacs.