From: harven <harven@free.fr>
To: help-gnu-emacs@gnu.org
Subject: Re: Move selection up, down
Date: Tue, 19 Aug 2008 14:27:11 -0700 (PDT) [thread overview]
Message-ID: <67d8af01-dce7-42e3-9a00-c4c5f3565469@d1g2000hsg.googlegroups.com> (raw)
In-Reply-To: 1422fa24-05d5-436b-82e2-b436af0a00a3@m3g2000hsc.googlegroups.com
On Aug 19, 4:21 pm, "jiri.pejc...@gmail.com" <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-<down>") 'line-down)
This may convince you that new functionalities
are easily added to emacs.
next prev parent reply other threads:[~2008-08-19 21:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-19 14:21 Move selection up, down jiri.pejchal
2008-08-19 21:27 ` harven [this message]
2008-08-19 22:43 ` Chat
2008-08-20 0:45 ` Andreas Politz
2008-09-11 17:04 ` Oleksandr Gavenko
2013-07-04 12:15 ` teemu.leisti
2014-12-12 19:14 ` jsglazer
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67d8af01-dce7-42e3-9a00-c4c5f3565469@d1g2000hsg.googlegroups.com \
--to=harven@free.fr \
--cc=help-gnu-emacs@gnu.org \
/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.
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).