unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* keybinding to duplicate the current line.
@ 2010-01-17 13:40 alin.s
  2010-01-17 14:19 ` Deniz Dogan
                   ` (6 more replies)
  0 siblings, 7 replies; 42+ messages in thread
From: alin.s @ 2010-01-17 13:40 UTC (permalink / raw)
  To: Emacs-devel


For me it would be very convenient to have a key-binding to duplicate the
current line.

In order to duplicate it I have to press

C-a C-SPACE C-e C-f M-w C-g C-y

It's too much for an usual function. C-x C-a would be good?

More than that, if I press C-u C-x C-a, I wish to duplicate the current
line, and to comment the old line.

Do you consider that such a function would be useful for many of you?
Otherwise, I have to wtite it myseld in my own .emacs...



-- 
View this message in context: http://old.nabble.com/keybinding-to-duplicate-the-current-line.-tp27198868p27198868.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 13:40 alin.s
@ 2010-01-17 14:19 ` Deniz Dogan
  2010-01-17 14:28   ` Ken Hori
  2010-01-17 14:22 ` Daniel Colascione
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 42+ messages in thread
From: Deniz Dogan @ 2010-01-17 14:19 UTC (permalink / raw)
  To: alin.s; +Cc: Emacs-devel

2010/1/17 alin.s <alinsoar@voila.fr>:
>
> For me it would be very convenient to have a key-binding to duplicate the
> current line.
>
> In order to duplicate it I have to press
>
> C-a C-SPACE C-e C-f M-w C-g C-y
>
> It's too much for an usual function. C-x C-a would be good?
>
> More than that, if I press C-u C-x C-a, I wish to duplicate the current
> line, and to comment the old line.
>
> Do you consider that such a function would be useful for many of you?
> Otherwise, I have to wtite it myseld in my own .emacs...
>

I have such a function bound to M-k but I never find the use for it.

-- 
Deniz Dogan




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 13:40 alin.s
  2010-01-17 14:19 ` Deniz Dogan
@ 2010-01-17 14:22 ` Daniel Colascione
  2010-01-17 14:31 ` Dirk-Jan C. Binnema
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 42+ messages in thread
From: Daniel Colascione @ 2010-01-17 14:22 UTC (permalink / raw)
  To: alin.s; +Cc: Emacs development discussions

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 1/17/10 8:40 AM, alin.s wrote:
> For me it would be very convenient to have a key-binding to duplicate the
> current line.

M-x load-library RET misc RET
C-h f copy-from-above-command

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iEYEARECAAYFAktTHUAACgkQ17c2LVA10VvFZACgzEKkMcn7Bfh2w0qt+4NUDpHD
4bUAoLPV6CWYrbz3c1DQuBPay48QuUhW
=Tipc
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 14:19 ` Deniz Dogan
@ 2010-01-17 14:28   ` Ken Hori
  0 siblings, 0 replies; 42+ messages in thread
From: Ken Hori @ 2010-01-17 14:28 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: alin.s, Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

i frequently use a local command to duplicate the marked string and
comment out the first instance (or the second depending on the cursor
point).
Pretty useful stuff.

On Sun, Jan 17, 2010 at 6:19 AM, Deniz Dogan <deniz.a.m.dogan@gmail.com>wrote:

> 2010/1/17 alin.s <alinsoar@voila.fr>:
> >
> > For me it would be very convenient to have a key-binding to duplicate the
> > current line.
> >
> > In order to duplicate it I have to press
> >
> > C-a C-SPACE C-e C-f M-w C-g C-y
> >
> > It's too much for an usual function. C-x C-a would be good?
> >
> > More than that, if I press C-u C-x C-a, I wish to duplicate the current
> > line, and to comment the old line.
> >
> > Do you consider that such a function would be useful for many of you?
> > Otherwise, I have to wtite it myseld in my own .emacs...
> >
>
> I have such a function bound to M-k but I never find the use for it.
>
> --
> Deniz Dogan
>
>
>

[-- Attachment #2: Type: text/html, Size: 1402 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 13:40 alin.s
  2010-01-17 14:19 ` Deniz Dogan
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 42+ messages in thread
From: Dirk-Jan C. Binnema @ 2010-01-17 14:31 UTC (permalink / raw)
  To: alin.s; +Cc: Emacs-devel

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




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
@ 2010-01-17 14:34 A. Soare
  0 siblings, 0 replies; 42+ messages in thread
From: A. Soare @ 2010-01-17 14:34 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: Emacs   Dev  [emacs-devel]



> For me it would be very convenient to have a key-binding to duplicate the
> > current line.
> 
> M-x load-library RET misc RET
> C-h f copy-from-above-command

great! this function is useful when I want to make a modification to the old code, and keep th eold version too.


thanks.



____________________________________________________

Vous n’avez pas encore adressé vos voeux ? Retrouvez nos cartes sur http://carte-de-voeux.voila.fr 







^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 13:40 alin.s
                   ` (2 preceding siblings ...)
  2010-01-17 14:31 ` Dirk-Jan C. Binnema
@ 2010-01-17 14:37 ` Dirk-Jan C. Binnema
  2010-01-17 14:42   ` Ken Hori
  2010-01-17 14:52   ` Dirk-Jan C. Binnema
  2010-01-17 14:58 ` Helmut Eller
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 42+ messages in thread
From: Dirk-Jan C. Binnema @ 2010-01-17 14:37 UTC (permalink / raw)
  To: Emacs-devel

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




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 14:37 ` Dirk-Jan C. Binnema
@ 2010-01-17 14:42   ` Ken Hori
  2010-01-17 14:51     ` Daniel Colascione
  2010-01-17 14:52   ` Dirk-Jan C. Binnema
  1 sibling, 1 reply; 42+ messages in thread
From: Ken Hori @ 2010-01-17 14:42 UTC (permalink / raw)
  To: djcb; +Cc: Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1749 bytes --]

Mine's with a region.

(defun comment-and-duplicate-region (start end)
  (interactive "r")
  (let ((s (buffer-substring start end)))
    (comment-region start end)
    (beginning-of-line)
    (save-excursion (insert s))))


On Sun, Jan 17, 2010 at 6:37 AM, Dirk-Jan C. Binnema <djcb.bulk@gmail.com>wrote:

> 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 <e%3Adjcb@djcbsoftware.nl>           w:
> www.djcbsoftware.nl
> pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C
>
>
>

[-- Attachment #2: Type: text/html, Size: 2553 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 14:42   ` Ken Hori
@ 2010-01-17 14:51     ` Daniel Colascione
  0 siblings, 0 replies; 42+ messages in thread
From: Daniel Colascione @ 2010-01-17 14:51 UTC (permalink / raw)
  To: Ken Hori; +Cc: djcb, Emacs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 1/17/10 9:42 AM, Ken Hori wrote:
> Mine's with a region.
> 
> (defun comment-and-duplicate-region (start end)

It seems like a lot of people (myself included) have private versions of
this functionality. Can we get something in Emacs?

Or at least move copy-from-above into simple.el?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iEYEARECAAYFAktTI/YACgkQ17c2LVA10VtDPwCgqv4S+W8oxSgcH2kQ05gqtZfV
zK4An0DDiv4WmP7BqviOQ2OY4R7SoWbi
=ETpn
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 14:37 ` Dirk-Jan C. Binnema
  2010-01-17 14:42   ` Ken Hori
@ 2010-01-17 14:52   ` Dirk-Jan C. Binnema
  1 sibling, 0 replies; 42+ messages in thread
From: Dirk-Jan C. Binnema @ 2010-01-17 14:52 UTC (permalink / raw)
  To: djcb; +Cc: Emacs-devel

>>>>> Dirk-Jan C Binnema <djcb.bulk@gmail.com> writes:

    > Hi,
>>>>> "alin" == alin s <alinsoar@voila.fr> writes:

    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:

<snip>
    
That was a bit *too* quick and dirty, this works better:

(defun comment-and-dup ()
  "duplicate line at point, and comment the current one"
  (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))
      (insert-string str)))
  (next-line))


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




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 13:40 alin.s
                   ` (3 preceding siblings ...)
  2010-01-17 14:37 ` Dirk-Jan C. Binnema
@ 2010-01-17 14:58 ` Helmut Eller
  2010-01-17 15:05 ` Teemu Likonen
  2010-01-19  8:40 ` mansoor_2233
  6 siblings, 0 replies; 42+ messages in thread
From: Helmut Eller @ 2010-01-17 14:58 UTC (permalink / raw)
  To: emacs-devel

* alin.s [2010-01-17 14:40+0100] writes:

> Do you consider that such a function would be useful for many of you?

A standard keybinding would be useful for me.  I use C-x , because that
key wasn't taken yet.

Helmut

(defun copy-line ()
  "Copy the current line."
  (interactive)
  (let ((col (current-column))
        (beg (progn (beginning-of-line) (point)))
        (end (progn (end-of-line) (point))))
    (forward-line)
    (save-excursion (insert (buffer-substring beg end) "\n"))
    (move-to-column col)))

(global-set-key "\C-x," 'copy-line)





^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 13:40 alin.s
                   ` (4 preceding siblings ...)
  2010-01-17 14:58 ` Helmut Eller
@ 2010-01-17 15:05 ` Teemu Likonen
  2010-01-17 15:10   ` Lennart Borgman
                     ` (2 more replies)
  2010-01-19  8:40 ` mansoor_2233
  6 siblings, 3 replies; 42+ messages in thread
From: Teemu Likonen @ 2010-01-17 15:05 UTC (permalink / raw)
  To: alin.s; +Cc: Emacs-devel

On 2010-01-17 05:40 (-0800), alin s. wrote:

> In order to duplicate it I have to press
>
> C-a C-SPACE C-e C-f M-w C-g C-y

Quicker alternatives:

    C-a C-k C-k C-y C-y
    C-a C-SPC C-n M-w C-y




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:05 ` Teemu Likonen
@ 2010-01-17 15:10   ` Lennart Borgman
  2010-01-17 15:13   ` Ken Hori
  2010-01-18  5:39   ` Thien-Thi Nguyen
  2 siblings, 0 replies; 42+ messages in thread
From: Lennart Borgman @ 2010-01-17 15:10 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: alin.s, Emacs-devel

On Sun, Jan 17, 2010 at 4:05 PM, Teemu Likonen <tlikonen@iki.fi> wrote:
> On 2010-01-17 05:40 (-0800), alin s. wrote:
>
>> In order to duplicate it I have to press
>>
>> C-a C-SPACE C-e C-f M-w C-g C-y
>
> Quicker alternatives:
>
>    C-a C-k C-k C-y C-y
>    C-a C-SPC C-n M-w C-y


Maybe it is worth mentioning that things like this are very easy with
vi style bindings. With Viper you do

  y y p




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  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-18  5:39   ` Thien-Thi Nguyen
  2 siblings, 1 reply; 42+ messages in thread
From: Ken Hori @ 2010-01-17 15:13 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: alin.s, Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

Oh please...

How about sacrificing one keyseq and make your own keymap like this:

(defvar foo-map (make-sparse-keymap))
(fset 'foo-map foo-map)
(global-unset-key "\C-t")
(global-set-key "\C-t"  'foo-map)

(define-key foo-map "d" 'comment-and-duplicate-region)
(define-key foo-map ...)
(define-key foo-map ...)

Believe me, such keybindings will save a huge amount of time in the long
run.

On Sun, Jan 17, 2010 at 7:05 AM, Teemu Likonen <tlikonen@iki.fi> wrote:

> On 2010-01-17 05:40 (-0800), alin s. wrote:
>
> > In order to duplicate it I have to press
> >
> > C-a C-SPACE C-e C-f M-w C-g C-y
>
> Quicker alternatives:
>
>    C-a C-k C-k C-y C-y
>    C-a C-SPC C-n M-w C-y
>
>
>

[-- Attachment #2: Type: text/html, Size: 1101 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:13   ` Ken Hori
@ 2010-01-17 15:18     ` Deniz Dogan
  2010-01-17 15:30       ` Ken Hori
  0 siblings, 1 reply; 42+ messages in thread
From: Deniz Dogan @ 2010-01-17 15:18 UTC (permalink / raw)
  To: Ken Hori; +Cc: alin.s, Teemu Likonen, Emacs-devel

2010/1/17 Ken Hori <fplemma@gmail.com>:
> Oh please...
>
> How about sacrificing one keyseq and make your own keymap like this:
>

Or just use "C-c <one letter>".

-- 
Deniz Dogan




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:18     ` Deniz Dogan
@ 2010-01-17 15:30       ` Ken Hori
  2010-01-17 15:31         ` Deniz Dogan
  2010-01-18 11:56         ` Richard Stallman
  0 siblings, 2 replies; 42+ messages in thread
From: Ken Hori @ 2010-01-17 15:30 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: alin.s, Teemu Likonen, Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

C-c prefix is supposed to be "reserved" for end-users.
But the sad reality is that more than several major-modes
break the convention by overriding C-c ... . So I no longer
use C-c prefix and instead define my own keymap.
It is more secure, at least probabilistically speaking.

Actually, I even append a hook to after-change-major-mode-hook so that
important local keybindings will never be taken by a major mode.


On Sun, Jan 17, 2010 at 7:18 AM, Deniz Dogan <deniz.a.m.dogan@gmail.com>wrote:

> 2010/1/17 Ken Hori <fplemma@gmail.com>:
> > Oh please...
> >
> > How about sacrificing one keyseq and make your own keymap like this:
> >
>
> Or just use "C-c <one letter>".
>
> --
> Deniz Dogan
>

[-- Attachment #2: Type: text/html, Size: 1162 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:30       ` Ken Hori
@ 2010-01-17 15:31         ` Deniz Dogan
  2010-01-17 15:38           ` Chong Yidong
  2010-01-17 16:17           ` Lennart Borgman
  2010-01-18 11:56         ` Richard Stallman
  1 sibling, 2 replies; 42+ messages in thread
From: Deniz Dogan @ 2010-01-17 15:31 UTC (permalink / raw)
  To: Ken Hori; +Cc: alin.s, Teemu Likonen, Emacs-devel

2010/1/17 Ken Hori <fplemma@gmail.com>:
>
> C-c prefix is supposed to be "reserved" for end-users.
> But the sad reality is that more than several major-modes
> break the convention by overriding C-c ... . So I no longer
> use C-c prefix and instead define my own keymap.
> It is more secure, at least probabilistically speaking.
>

I don't think any major mode I know of binds "C-c <letter>". Note that
by <letter> I mean e.g. "C-c i", "C-c a", etc., not "C-c C-i" or "C-c
C-a".

-- 
Deniz Dogan




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
@ 2010-01-17 15:32 A. Soare
  2010-01-17 16:02 ` Teemu Likonen
  2010-01-19 16:59 ` Davis Herring
  0 siblings, 2 replies; 42+ messages in thread
From: A. Soare @ 2010-01-17 15:32 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: Emacs   Dev  [emacs-devel]


> > In order to duplicate it I have to press
> >
> > C-a C-SPACE C-e C-f M-w C-g C-y
> 
> Quicker alternatives:

these are quicker only in some particular cases:

> 
>     C-a C-k C-k C-y C-y

this is true when kill-whole-line is nil.


>     C-a C-SPC C-n M-w C-y

and this is true when line-move-visual is nil.



____________________________________________________

Vous n’avez pas encore adressé vos voeux ? Retrouvez nos cartes sur http://carte-de-voeux.voila.fr 







^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  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
  1 sibling, 1 reply; 42+ messages in thread
From: Chong Yidong @ 2010-01-17 15:38 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: Ken Hori, alin.s, Teemu Likonen, Emacs-devel

Deniz Dogan <deniz.a.m.dogan@gmail.com> writes:

> 2010/1/17 Ken Hori <fplemma@gmail.com>:
>>
>> C-c prefix is supposed to be "reserved" for end-users.
>> But the sad reality is that more than several major-modes
>> break the convention by overriding C-c ... . So I no longer
>> use C-c prefix and instead define my own keymap.
>> It is more secure, at least probabilistically speaking.
>>
>
> I don't think any major mode I know of binds "C-c <letter>". Note that
> by <letter> I mean e.g. "C-c i", "C-c a", etc., not "C-c C-i" or "C-c
> C-a".

Indeed.  If you find any major mode that binds C-c <letter>, it is a
bug, so please report it.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:38           ` Chong Yidong
@ 2010-01-17 15:48             ` Ken Hori
  0 siblings, 0 replies; 42+ messages in thread
From: Ken Hori @ 2010-01-17 15:48 UTC (permalink / raw)
  To: Chong Yidong; +Cc: alin.s, Teemu Likonen, Emacs-devel, Deniz Dogan

[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]

I just took a look inside lisp/ dir.

modula2.el overrides C-c <letter> keybindings (and so it is a bug).

All else look good (inf-lisp.el and sgml-mode.el do have a non-default-on
switch to give
C-c <letter> bindings).

There are more than a few non-standard elisp packages (@ELL or emacs-wiki)
that
are not aware of the C-c <letter> convention, I'm sure.
I guess I'll stick with not using C-c prefix for now.


On Sun, Jan 17, 2010 at 7:38 AM, Chong Yidong <cyd@stupidchicken.com> wrote:

> Deniz Dogan <deniz.a.m.dogan@gmail.com> writes:
>
> > 2010/1/17 Ken Hori <fplemma@gmail.com>:
> >>
> >> C-c prefix is supposed to be "reserved" for end-users.
> >> But the sad reality is that more than several major-modes
> >> break the convention by overriding C-c ... . So I no longer
> >> use C-c prefix and instead define my own keymap.
> >> It is more secure, at least probabilistically speaking.
> >>
> >
> > I don't think any major mode I know of binds "C-c <letter>". Note that
> > by <letter> I mean e.g. "C-c i", "C-c a", etc., not "C-c C-i" or "C-c
> > C-a".
>
> Indeed.  If you find any major mode that binds C-c <letter>, it is a
> bug, so please report it.
>

[-- Attachment #2: Type: text/html, Size: 1823 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:32 A. Soare
@ 2010-01-17 16:02 ` Teemu Likonen
  2010-01-19 16:59 ` Davis Herring
  1 sibling, 0 replies; 42+ messages in thread
From: Teemu Likonen @ 2010-01-17 16:02 UTC (permalink / raw)
  To: alinsoar; +Cc: Emacs Dev [emacs-devel]

On 2010-01-17 16:32 (+0100), A. Soare wrote:

>>     C-a C-SPC C-n M-w C-y
>
> and this is true when line-move-visual is nil.

I use it even when I have line-move-visual=t.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:31         ` Deniz Dogan
  2010-01-17 15:38           ` Chong Yidong
@ 2010-01-17 16:17           ` Lennart Borgman
  1 sibling, 0 replies; 42+ messages in thread
From: Lennart Borgman @ 2010-01-17 16:17 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: Ken Hori, alin.s, Teemu Likonen, Emacs-devel

On Sun, Jan 17, 2010 at 4:31 PM, Deniz Dogan <deniz.a.m.dogan@gmail.com> wrote:
> 2010/1/17 Ken Hori <fplemma@gmail.com>:
>>
>> C-c prefix is supposed to be "reserved" for end-users.
>> But the sad reality is that more than several major-modes
>> break the convention by overriding C-c ... . So I no longer
>> use C-c prefix and instead define my own keymap.
>> It is more secure, at least probabilistically speaking.
>>
>
> I don't think any major mode I know of binds "C-c <letter>". Note that
> by <letter> I mean e.g. "C-c i", "C-c a", etc., not "C-c C-i" or "C-c
> C-a".

Yes, please not that it is onley "C-c <letter>" that is reserved for users. See

  (info "(elisp) Key Binding Conventions")




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
@ 2010-01-17 17:17 A. Soare
  2010-01-18  1:45 ` Stephen J. Turnbull
  2010-01-20  8:16 ` Teemu Likonen
  0 siblings, 2 replies; 42+ messages in thread
From: A. Soare @ 2010-01-17 17:17 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: Emacs   Dev  [emacs-devel]


> On 2010-01-17 16:32 (+0100), A. Soare wrote:
> 
> >>     C-a C-SPC C-n M-w C-y
> >
> > and this is true when line-move-visual is nil.
> 
> I use it even when I have line-move-visual=t.

Then you do something bad, or at least bad for me.

doc: /* Take cdr N times on LIST,
returns the result.  */)

<your keys>

will become 

doc: /* Take cdr N times on LIST,
doc: /* Take cdr N times on LIST,
returns the result.  */)


(on 1 line).




____________________________________________________

Vous n’avez pas encore adressé vos voeux ? Retrouvez nos cartes sur http://carte-de-voeux.voila.fr 







^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 17:17 keybinding to duplicate the current line A. Soare
@ 2010-01-18  1:45 ` Stephen J. Turnbull
  2010-01-20  8:16 ` Teemu Likonen
  1 sibling, 0 replies; 42+ messages in thread
From: Stephen J. Turnbull @ 2010-01-18  1:45 UTC (permalink / raw)
  To: alinsoar; +Cc: Teemu Likonen, Emacs   Dev  [emacs-devel]

A. Soare writes:
 > 
 > > On 2010-01-17 16:32 (+0100), A. Soare wrote:
 > > 
 > > >>     C-a C-SPC C-n M-w C-y
 > > >
 > > > and this is true when line-move-visual is nil.
 > > 
 > > I use it even when I have line-move-visual=t.
 > 
 > Then you do something bad, or at least bad for me.

True, that is a matter of personal preference and the data in front of
you (eg, you might have line-move-visual on, but be working on code
from a project with a strict line-length limit).  But AIUI
line-move-visual mode, doesn't C-a C-SPC C-e C-f M-w C-y do the wrong
thing for you too?  I almost never use long lines, but I would find it
very strange if C-a and C-e didn't have the same concept of "line" as
C-n and C-p do.





^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:05 ` Teemu Likonen
  2010-01-17 15:10   ` Lennart Borgman
  2010-01-17 15:13   ` Ken Hori
@ 2010-01-18  5:39   ` Thien-Thi Nguyen
  2 siblings, 0 replies; 42+ messages in thread
From: Thien-Thi Nguyen @ 2010-01-18  5:39 UTC (permalink / raw)
  To: Emacs-devel

() Teemu Likonen <tlikonen@iki.fi>
() Sun, 17 Jan 2010 17:05:46 +0200

   On 2010-01-17 05:40 (-0800), alin s. wrote:

   > In order to duplicate it I have to press
   >
   > C-a C-SPACE C-e C-f M-w C-g C-y

   Quicker alternatives:

       C-a C-k C-k C-y C-y
       C-a C-SPC C-n M-w C-y

There is also kill-whole-line, yank, yank, e.g.:
(global-set-key [f7] [(control shift backspace) (control y) (control y)])

thi




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:30       ` Ken Hori
  2010-01-17 15:31         ` Deniz Dogan
@ 2010-01-18 11:56         ` Richard Stallman
  2010-01-18 16:28           ` Deniz Dogan
  2010-01-18 18:29           ` Ken Hori
  1 sibling, 2 replies; 42+ messages in thread
From: Richard Stallman @ 2010-01-18 11:56 UTC (permalink / raw)
  To: Ken Hori; +Cc: alinsoar, tlikonen, Emacs-devel, deniz.a.m.dogan

    C-c prefix is supposed to be "reserved" for end-users.
    But the sad reality is that more than several major-modes
    break the convention by overriding C-c ... . 

We need to fix those modes.
Can you say which modes they are?




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-18 11:56         ` Richard Stallman
@ 2010-01-18 16:28           ` Deniz Dogan
  2010-01-19 15:00             ` Richard Stallman
  2010-01-18 18:29           ` Ken Hori
  1 sibling, 1 reply; 42+ messages in thread
From: Deniz Dogan @ 2010-01-18 16:28 UTC (permalink / raw)
  To: rms; +Cc: Ken Hori, alinsoar, tlikonen, Emacs-devel

2010/1/18 Richard Stallman <rms@gnu.org>:
>    C-c prefix is supposed to be "reserved" for end-users.
>    But the sad reality is that more than several major-modes
>    break the convention by overriding C-c ... .
>
> We need to fix those modes.
> Can you say which modes they are?
>

If someone decides to look into this matter, could that person also
see if there are any modes that make C-g part of any key sequences?
E.g. haskell-mode used "C-c C-g" before.

I don't know if C-g is explicitly forbidden to use in mode key
sequences, but I really think it should be.

-- 
Deniz Dogan




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-18 11:56         ` Richard Stallman
  2010-01-18 16:28           ` Deniz Dogan
@ 2010-01-18 18:29           ` Ken Hori
  1 sibling, 0 replies; 42+ messages in thread
From: Ken Hori @ 2010-01-18 18:29 UTC (permalink / raw)
  To: rms; +Cc: alinsoar, tlikonen, Emacs-devel, deniz.a.m.dogan

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

If limited to keybindings of the form \C-c <letter>, at least the
following GNU Emacs standard packages seem to be affected (as of 2010/1/12):

1. delphi-mode (progmodes/delphi.el)
        "\C-cu" 'delphi-find-unit

2. semantic-grammar-mode (cedet/semantic/grammar.el)
    "\C-cm" 'semantic-grammar-find-macro-expander

3. modula-2-mode (progmodes/modula2.el)
    A lot. E.g.,
    "\C-cb" 'm2-begin
    "\C-cc" 'm2-case

I didn't check packages that are not included in GNU Emacs.


On Mon, Jan 18, 2010 at 3:56 AM, Richard Stallman <rms@gnu.org> wrote:

>    C-c prefix is supposed to be "reserved" for end-users.
>    But the sad reality is that more than several major-modes
>    break the convention by overriding C-c ... .
>
> We need to fix those modes.
> Can you say which modes they are?
>

[-- Attachment #2: Type: text/html, Size: 1216 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
@ 2010-01-18 19:50 A. Soare
  2010-01-19 15:01 ` Richard Stallman
  0 siblings, 1 reply; 42+ messages in thread
From: A. Soare @ 2010-01-18 19:50 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: Emacs   Dev  [emacs-devel]


The defintions of keybindings of major modes can be considered a regular language?

To write somehow a regular expressions and scan all code sources for defintions ?








> 2010/1/18 Richard Stallman <rms@gnu.org>:
> >    C-c prefix is supposed to be "reserved" for end-users.
> >    But the sad reality is that more than several major-modes
> >    break the convention by overriding C-c ... .
> >
> > We need to fix those modes.
> > Can you say which modes they are?
> >
> 
> If someone decides to look into this matter, could that person also
> see if there are any modes that make C-g part of any key sequences?
> E.g. haskell-mode used "C-c C-g" before.
> 
> I don't know if C-g is explicitly forbidden to use in mode key
> sequences, but I really think it should be.
> 
> -- 
> Deniz Dogan
> 
> 

____________________________________________________

Je m’évite la cohue dans les magasins et je profite des petits prix sur http://shopping.voila.fr







^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 13:40 alin.s
                   ` (5 preceding siblings ...)
  2010-01-17 15:05 ` Teemu Likonen
@ 2010-01-19  8:40 ` mansoor_2233
  2010-01-19 16:05   ` David Kastrup
  6 siblings, 1 reply; 42+ messages in thread
From: mansoor_2233 @ 2010-01-19  8:40 UTC (permalink / raw)
  To: emacs-devel

-- alin.s wrote : 

For me it would be very convenient to have a key-binding to duplicate the
current line.

In order to duplicate it I have to press

C-a C-SPACE C-e C-f M-w C-g C-y

It's too much for an usual function. C-x C-a would be good?

More than that, if I press C-u C-x C-a, I wish to duplicate the current
line, and to comment the old line.

Do you consider that such a function would be useful for many of you?
Otherwise, I have to wtite it myseld in my own .emacs...



-- 
View this message in context: http://old.nabble.com/keybinding-to-duplicate-the-current-line.-tp27198868p27198868.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.





--
This message was sent on behalf of mansoor_2233@yahoo.com at openSubscriber.com
http://www.opensubscriber.com/message/emacs-devel@gnu.org/13285779.html




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-18 16:28           ` Deniz Dogan
@ 2010-01-19 15:00             ` Richard Stallman
  2010-01-19 15:29               ` Deniz Dogan
  0 siblings, 1 reply; 42+ messages in thread
From: Richard Stallman @ 2010-01-19 15:00 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: fplemma, alinsoar, tlikonen, Emacs-devel

    If someone decides to look into this matter, could that person also
    see if there are any modes that make C-g part of any key sequences?

Would you like to check for these problematical modes?
We could use your help.

    I don't know if C-g is explicitly forbidden to use in mode key
    sequences, but I really think it should be.

It is a really bad idea to use C-g for anything except quitting.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-18 19:50 A. Soare
@ 2010-01-19 15:01 ` Richard Stallman
  0 siblings, 0 replies; 42+ messages in thread
From: Richard Stallman @ 2010-01-19 15:01 UTC (permalink / raw)
  To: alinsoar; +Cc: emacs-devel, deniz.a.m.dogan

It should be easy to search for all calls to define-key
and then use Lisp code to check what key gets bound.
If that arg is not a string constant, it could be flagged
for human attention.  There are not many such cases.





^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-19 15:00             ` Richard Stallman
@ 2010-01-19 15:29               ` Deniz Dogan
  2010-01-21  9:47                 ` Deniz Dogan
  0 siblings, 1 reply; 42+ messages in thread
From: Deniz Dogan @ 2010-01-19 15:29 UTC (permalink / raw)
  To: rms; +Cc: fplemma, alinsoar, tlikonen, Emacs-devel

2010/1/19 Richard Stallman <rms@gnu.org>:
>    If someone decides to look into this matter, could that person also
>    see if there are any modes that make C-g part of any key sequences?
>
> Would you like to check for these problematical modes?
> We could use your help.
>

I'm on a Windows system at the moment and I don't know how to properly
install grep and other useful tools for the task, but having searched
through all .el files in the "lisp" directory, I found the following
bindings. Some of them are there to imitate other editors, so I guess
they are okay, but these are the ones that I _personally_ believe
could need some reviewing from more experienced Emacs hackers than
myself.

viper-keym.el
(define-key viper-insert-diehard-map "\C-g" 'self-insert-command)
(define-key viper-vi-basic-map "\C-c\C-g" 'viper-info-on-file)
(define-key viper-vi-diehard-map "\C-g" 'viper-info-on-file)

ws-mode.el
  (define-key wordstar-mode-map "\C-g" 'delete-char)

feedmail.el
    (?\C-g . feedmail-message-action-edit)

mh-letter.el
  "\C-c\C-m\C-g"        mh-mh-compose-anon-ftp

make-mode.el
    (define-key map "\C-c\C-m\C-g" 'makefile-gmake-mode)

vhdl-mode.el

  (if (featurep 'xemacs) ; `... C-g' not allowed in XEmacs
      (define-key vhdl-mode-map "\C-c\C-p\M-g" 'vhdl-port-paste-generic-map)
    (define-key vhdl-mode-map "\C-c\C-p\C-g" 'vhdl-port-paste-generic-map))

  (define-key vhdl-mode-map "\C-c\C-i\C-g" 'vhdl-indent-group)
  (define-key vhdl-mode-map "\C-c\C-a\C-g" 'vhdl-align-group)
  (define-key vhdl-mode-map "\C-c\C-f\C-g" 'vhdl-fill-group)
  (define-key vhdl-mode-map "\C-c\C-l\C-g" 'goto-line)

These were all found using a simple plain-text search for "\C-g", so I
may very well have missed a lot of them. I think the findings in
vhdl-mode.el are the most interesting, as the author clearly knew what
he/she was doing, making a special case of XEmacs. :)

-- 
Deniz Dogan




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-19  8:40 ` mansoor_2233
@ 2010-01-19 16:05   ` David Kastrup
  0 siblings, 0 replies; 42+ messages in thread
From: David Kastrup @ 2010-01-19 16:05 UTC (permalink / raw)
  To: emacs-devel

mansoor_2233@yahoo.com writes:

> -- alin.s wrote : 
>
> For me it would be very convenient to have a key-binding to duplicate the
> current line.
>
> In order to duplicate it I have to press
>
> C-a C-SPACE C-e C-f M-w C-g C-y

C-S-Backspace C-y C-y

-- 
David Kastrup





^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 15:32 A. Soare
  2010-01-17 16:02 ` Teemu Likonen
@ 2010-01-19 16:59 ` Davis Herring
  1 sibling, 0 replies; 42+ messages in thread
From: Davis Herring @ 2010-01-19 16:59 UTC (permalink / raw)
  To: alinsoar; +Cc: Teemu Likonen, Emacs   Dev  [emacs-devel]

>>     C-a C-k C-k C-y C-y
>
> this is true when kill-whole-line is nil.

And so what if it's not?  Then you get to drop one C-k.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-17 17:17 keybinding to duplicate the current line A. Soare
  2010-01-18  1:45 ` Stephen J. Turnbull
@ 2010-01-20  8:16 ` Teemu Likonen
  2010-01-21  2:41   ` Ken Hori
  1 sibling, 1 reply; 42+ messages in thread
From: Teemu Likonen @ 2010-01-20  8:16 UTC (permalink / raw)
  To: alinsoar; +Cc: Emacs Dev [emacs-devel]

On 2010-01-17 18:17 (+0100), A. Soare wrote:

>>>>     C-a C-SPC C-n M-w C-y
>>>
>>> and this is true when line-move-visual is nil.
>> I use it even when I have line-move-visual=t.
>
> Then you do something bad, or at least bad for me.

I don't consider doing anything bad when I copy and yank line(s) while
having line-move-visual=t :-)




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-20  8:16 ` Teemu Likonen
@ 2010-01-21  2:41   ` Ken Hori
  2010-01-21  3:34     ` Miles Bader
  0 siblings, 1 reply; 42+ messages in thread
From: Ken Hori @ 2010-01-21  2:41 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: alinsoar, Emacs Dev [emacs-devel]

[-- Attachment #1: Type: text/plain, Size: 762 bytes --]

Let's just add one of those comment-and-dup's suggested above or
its functional equivalent and end the those "you could use
<long-key-sequence>" comments.

Even in this thread, there seem to be more than several users
wanting this as a default function, which most likely means there
are many users who feel the same way.


On Wed, Jan 20, 2010 at 12:16 AM, Teemu Likonen <tlikonen@iki.fi> wrote:

> On 2010-01-17 18:17 (+0100), A. Soare wrote:
>
> >>>>     C-a C-SPC C-n M-w C-y
> >>>
> >>> and this is true when line-move-visual is nil.
> >> I use it even when I have line-move-visual=t.
> >
> > Then you do something bad, or at least bad for me.
>
> I don't consider doing anything bad when I copy and yank line(s) while
> having line-move-visual=t :-)
>
>
>

[-- Attachment #2: Type: text/html, Size: 1177 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-21  2:41   ` Ken Hori
@ 2010-01-21  3:34     ` Miles Bader
  2010-01-21  4:00       ` Ken Hori
  0 siblings, 1 reply; 42+ messages in thread
From: Miles Bader @ 2010-01-21  3:34 UTC (permalink / raw)
  To: Ken Hori; +Cc: alinsoar, Teemu Likonen, Emacs Dev [emacs-devel]

Ken Hori <fplemma@gmail.com> writes:
> Even in this thread, there seem to be more than several users
> wanting this as a default function, which most likely means there
> are many users who feel the same way.

That's a pretty shaky assertion...

I actually do this particular operation quite a bit, but I think there's
no need for a dedicated key sequence to for it -- the common idioms are
easy and fast to use and a lot more flexible than a dedicated command.

[I use "C-a C-k C-k C-y C-y", which is extremely easy (and quick) to
type because all the keys are C- chords, and because two of the keys are
just repeated.]

-Miles

-- 
Liberty, n. One of imagination's most precious possessions.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  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
  0 siblings, 2 replies; 42+ messages in thread
From: Ken Hori @ 2010-01-21  4:00 UTC (permalink / raw)
  To: Miles Bader; +Cc: alinsoar, Teemu Likonen, Emacs Dev [emacs-devel]

[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]

Miles,

> I actually do this particular operation quite a bit, but I
> think there's no need for a dedicated key sequence to for it --
> the common idioms are easy and fast to use and a lot more
> flexible than a dedicated command.

I don't mean to be picky here, but i think my assertion was and is less
shaky
than yours in that it consumes the opinions of alin.s, A. Soare, Daniel
Colascione and myself.

"C-a C-k C-k C-y C-y" involves 5 key strokes; and it can be dangerous and
easy
to get lost for the beginners too as it involves 2 killings and 2 yankings.

My point is that, since there are at least 4 people in this thread who want,
or
have already defined their version of, 'comment-and-dup' that there probably
are
a lot of existing users that would find it useful. So I think we should at
least
add such a function to simple.el (or the like) for them to use.


On Wed, Jan 20, 2010 at 7:34 PM, Miles Bader <miles@gnu.org> wrote:

> Ken Hori <fplemma@gmail.com> writes:
> > Even in this thread, there seem to be more than several users
> > wanting this as a default function, which most likely means there
> > are many users who feel the same way.
>
> That's a pretty shaky assertion...
>
> I actually do this particular operation quite a bit, but I think there's
> no need for a dedicated key sequence to for it -- the common idioms are
> easy and fast to use and a lot more flexible than a dedicated command.
>
> [I use "C-a C-k C-k C-y C-y", which is extremely easy (and quick) to
> type because all the keys are C- chords, and because two of the keys are
> just repeated.]
>
> -Miles
>
> --
> Liberty, n. One of imagination's most precious possessions.
>

[-- Attachment #2: Type: text/html, Size: 2208 bytes --]

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-21  4:00       ` Ken Hori
@ 2010-01-21  4:58         ` Miles Bader
  2010-01-21 14:29         ` Stefan Monnier
  1 sibling, 0 replies; 42+ messages in thread
From: Miles Bader @ 2010-01-21  4:58 UTC (permalink / raw)
  To: Ken Hori; +Cc: alinsoar, Teemu Likonen, Emacs Dev [emacs-devel]

Ken Hori <fplemma@gmail.com> writes:
> I don't mean to be picky here, but i think my assertion was and is
> less shaky than yours in that it consumes the opinions of alin.s,
> A. Soare, Daniel Colascione and myself.

As the saying goes, "data is not the plural of anecdote."

-Miles

-- 
Inhumanity, n. One of the signal and characteristic qualities of humanity.




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-19 15:29               ` Deniz Dogan
@ 2010-01-21  9:47                 ` Deniz Dogan
  0 siblings, 0 replies; 42+ messages in thread
From: Deniz Dogan @ 2010-01-21  9:47 UTC (permalink / raw)
  To: rms; +Cc: fplemma, alinsoar, tlikonen, Emacs-devel

2010/1/19 Deniz Dogan <deniz.a.m.dogan@gmail.com>:
> 2010/1/19 Richard Stallman <rms@gnu.org>:
>>    If someone decides to look into this matter, could that person also
>>    see if there are any modes that make C-g part of any key sequences?
>>
>> Would you like to check for these problematical modes?
>> We could use your help.
>>
>
> I'm on a Windows system at the moment and I don't know how to properly
> install grep and other useful tools for the task, but having searched
> through all .el files in the "lisp" directory, I found the following
> bindings. Some of them are there to imitate other editors, so I guess
> they are okay, but these are the ones that I _personally_ believe
> could need some reviewing from more experienced Emacs hackers than
> myself.
>
> viper-keym.el
> (define-key viper-insert-diehard-map "\C-g" 'self-insert-command)
> (define-key viper-vi-basic-map "\C-c\C-g" 'viper-info-on-file)
> (define-key viper-vi-diehard-map "\C-g" 'viper-info-on-file)
>
> ws-mode.el
>  (define-key wordstar-mode-map "\C-g" 'delete-char)
>
> feedmail.el
>    (?\C-g . feedmail-message-action-edit)
>
> mh-letter.el
>  "\C-c\C-m\C-g"        mh-mh-compose-anon-ftp
>
> make-mode.el
>    (define-key map "\C-c\C-m\C-g" 'makefile-gmake-mode)
>
> vhdl-mode.el
>
>  (if (featurep 'xemacs) ; `... C-g' not allowed in XEmacs
>      (define-key vhdl-mode-map "\C-c\C-p\M-g" 'vhdl-port-paste-generic-map)
>    (define-key vhdl-mode-map "\C-c\C-p\C-g" 'vhdl-port-paste-generic-map))
>
>  (define-key vhdl-mode-map "\C-c\C-i\C-g" 'vhdl-indent-group)
>  (define-key vhdl-mode-map "\C-c\C-a\C-g" 'vhdl-align-group)
>  (define-key vhdl-mode-map "\C-c\C-f\C-g" 'vhdl-fill-group)
>  (define-key vhdl-mode-map "\C-c\C-l\C-g" 'goto-line)
>
> These were all found using a simple plain-text search for "\C-g", so I
> may very well have missed a lot of them. I think the findings in
> vhdl-mode.el are the most interesting, as the author clearly knew what
> he/she was doing, making a special case of XEmacs. :)
>
> --
> Deniz Dogan
>

If I want to "fix" these issues, should I contact each of the
maintainers for these modes individually? I'm still pretty new to this
whole process.

-- 
Deniz Dogan




^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: keybinding to duplicate the current line.
  2010-01-21  4:00       ` Ken Hori
  2010-01-21  4:58         ` Miles Bader
@ 2010-01-21 14:29         ` Stefan Monnier
  1 sibling, 0 replies; 42+ messages in thread
From: Stefan Monnier @ 2010-01-21 14:29 UTC (permalink / raw)
  To: Ken Hori; +Cc: alinsoar, Teemu Likonen, Emacs Dev [emacs-devel], Miles Bader

> I don't mean to be picky here, but i think my assertion was and is
> less shaky than yours in that it consumes the opinions of alin.s,
> A. Soare, Daniel Colascione and myself.

> "C-a C-k C-k C-y C-y" involves 5 key strokes; and it can be dangerous
> and easy to get lost for the beginners too as it involves 2 killings
> and 2 yankings.

> My point is that, since there are at least 4 people in this thread who
> want, or have already defined their version of, 'comment-and-dup' that
> there probably are a lot of existing users that would find it
> useful. So I think we should at least add such a function to simple.el
> (or the like) for them to use.

Emacs is highly configurable.  You can very easily make that
line-duplicating command yourself, even without knowing any Elisp
(using a keyboard macro).  So clearly, the most important change would
not be to add such a command to Emacs, but to give it a key-binding, and
there lies the rub.  It's quite likely that any keybinding we could come
up with would not be significantly easier to type (and remember)
than Miles's.


        Stefan




^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2010-01-21 14:29 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-17 17:17 keybinding to duplicate the current line 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
  -- strict thread matches above, loose matches on Subject: below --
2010-01-18 19:50 A. Soare
2010-01-19 15:01 ` Richard Stallman
2010-01-17 15:32 A. Soare
2010-01-17 16:02 ` Teemu Likonen
2010-01-19 16:59 ` Davis Herring
2010-01-17 14:34 A. Soare
2010-01-17 13:40 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
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).