From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chat Newsgroups: gmane.emacs.help Subject: Re: Move selection up, down Date: Tue, 19 Aug 2008 15:43:48 -0700 Organization: Noname Inc. Message-ID: References: <1422fa24-05d5-436b-82e2-b436af0a00a3@m3g2000hsc.googlegroups.com> <67d8af01-dce7-42e3-9a00-c4c5f3565469@d1g2000hsg.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1219189261 23373 80.91.229.12 (19 Aug 2008 23:41:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Aug 2008 23:41:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 20 01:41:53 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 1KVapg-0000Er-QF for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Aug 2008 01:41:49 +0200 Original-Received: from localhost ([127.0.0.1]:35340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVaoj-00070x-09 for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Aug 2008 19:40:49 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!flpi089.ffdc.sbc.com!prodigy.net!flpi088.ffdc.sbc.com!prodigy.com!flpi107.ffdc.sbc.com!nlpi061.nbdc.sbc.com.POSTED!1c384869!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Emacs Gnus Cancel-Lock: sha1:1muJiA7PXX/MxEEeHKP4QMm0R2s= Original-Lines: 45 Original-NNTP-Posting-Host: 76.199.139.154 Original-X-Complaints-To: abuse@prodigy.net Original-X-Trace: nlpi061.nbdc.sbc.com 1219185828 ST000 76.199.139.154 (Tue, 19 Aug 2008 18:43:48 EDT) Original-NNTP-Posting-Date: Tue, 19 Aug 2008 18:43:48 EDT X-UserInfo1: OPYCR^WGAJWWS]ISN[O@_WH@YR_B@EXLLBWLOOAFJYWZUYICD^RAQBKZQTZTX\_I[^G_KGFNON[ZOE_AZNVO^\XGGNTCIRPIJH[@RQKBXLRZ@CD^HKANYVW@RLGEZEJN@\_WZJBNZYYKVIOR]T]MNMG_Z[YVWSCH_Q[GPC_A@CARQVXDSDA^M]@DRVUM@RBM Original-Xref: news.stanford.edu gnu.emacs.help:161450 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:56796 Archived-At: harven writes: > On Aug 19, 4:21 pm, "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. For simple things like this, reading the secion "emacs" -> "keyboard macros" in M-x info also helps.