From: Dirk-Jan C. Binnema <djcb.bulk@gmail.com>
To: Emacs-devel@gnu.org
Subject: Re: keybinding to duplicate the current line.
Date: Sun, 17 Jan 2010 16:37:19 +0200 [thread overview]
Message-ID: <87fx64x0f4.wl%djcb@djcbsoftware.nl> (raw)
In-Reply-To: <27198868.post@talk.nabble.com>
Hi,
>>>>> "alin" == alin s <alinsoar@voila.fr> writes:
alin> For me it would be very convenient to have a key-binding to duplicate the
alin> current line.
alin> In order to duplicate it I have to press
alin> C-a C-SPACE C-e C-f M-w C-g C-y
alin> It's too much for an usual function. C-x C-a would be good?
I like 'slick copy', ie., copy without needing to select:
http://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html
Then, you can duplicate lines with:
M-w C-y
Which is very natural.
alin> More than that, if I press C-u C-x C-a, I wish to duplicate the current
alin> line, and to comment the old line.
alin> Do you consider that such a function would be useful for many of you?
alin> Otherwise, I have to wtite it myseld in my own .emacs...
Something quick and fairly dirty:
(defun comment-and-dup ()
(interactive)
(save-excursion
(beginning-of-line)
(push-mark)
(forward-line 1)
(let ((str (buffer-substring (region-beginning) (region-end))))
(comment-region (region-beginning) (region-end))
(next-line)
(insert-string str))))
Best wishes,
Dirk.
--
Dirk-Jan C. Binnema Helsinki, Finland
e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C
next prev parent reply other threads:[~2010-01-17 14:37 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-17 13:40 keybinding to duplicate the current line alin.s
2010-01-17 14:19 ` Deniz Dogan
2010-01-17 14:28 ` Ken Hori
2010-01-17 14:22 ` Daniel Colascione
2010-01-17 14:31 ` Dirk-Jan C. Binnema
2010-01-17 14:37 ` Dirk-Jan C. Binnema [this message]
2010-01-17 14:42 ` Ken Hori
2010-01-17 14:51 ` Daniel Colascione
2010-01-17 14:52 ` Dirk-Jan C. Binnema
2010-01-17 14:58 ` Helmut Eller
2010-01-17 15:05 ` Teemu Likonen
2010-01-17 15:10 ` Lennart Borgman
2010-01-17 15:13 ` Ken Hori
2010-01-17 15:18 ` Deniz Dogan
2010-01-17 15:30 ` Ken Hori
2010-01-17 15:31 ` Deniz Dogan
2010-01-17 15:38 ` Chong Yidong
2010-01-17 15:48 ` Ken Hori
2010-01-17 16:17 ` Lennart Borgman
2010-01-18 11:56 ` Richard Stallman
2010-01-18 16:28 ` Deniz Dogan
2010-01-19 15:00 ` Richard Stallman
2010-01-19 15:29 ` Deniz Dogan
2010-01-21 9:47 ` Deniz Dogan
2010-01-18 18:29 ` Ken Hori
2010-01-18 5:39 ` Thien-Thi Nguyen
2010-01-19 8:40 ` mansoor_2233
2010-01-19 16:05 ` David Kastrup
-- strict thread matches above, loose matches on Subject: below --
2010-01-17 14:34 A. Soare
2010-01-17 15:32 A. Soare
2010-01-17 16:02 ` Teemu Likonen
2010-01-19 16:59 ` Davis Herring
2010-01-17 17:17 A. Soare
2010-01-18 1:45 ` Stephen J. Turnbull
2010-01-20 8:16 ` Teemu Likonen
2010-01-21 2:41 ` Ken Hori
2010-01-21 3:34 ` Miles Bader
2010-01-21 4:00 ` Ken Hori
2010-01-21 4:58 ` Miles Bader
2010-01-21 14:29 ` Stefan Monnier
2010-01-18 19:50 A. Soare
2010-01-19 15:01 ` Richard Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fx64x0f4.wl%djcb@djcbsoftware.nl \
--to=djcb.bulk@gmail.com \
--cc=Emacs-devel@gnu.org \
--cc=djcb@djcbsoftware.nl \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.