bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46621: Copy line


From: Mattias Engdegård
Subject: bug#46621: Copy line
Date: Sat, 25 Jun 2022 18:51:42 +0200

23 juni 2022 kl. 19.35 skrev Juri Linkov <juri@linkov.net>:

> Usually I duplicate only 1 line, and in 100% of cases the cursor needs
> to be on the copied line to start editing it.  But when duplicating
> more lines with a prefix arg, often it's expected to have the cursor
> on the top copied line to start editing copied lines top-down.
> I wonder if this is a common use case.

If only one duplicate was made then perhaps it doesn't matter that much if the 
cursor has to be moved down one step before editing? (I don't find it to be 100 
% of the cases at all; sometimes I want the modified line to be above the 
original line, sometimes below.)

>> * A single-key binding (like H-y but not C-x y) makes quite
>> a difference because that way I can quickly stutter out copies as
>> needed without having to plan ahead and use prefix arguments.
> 
> I don't believe everyone would agree on such short keys.

Quite the contrary, they definitely would! What they wouldn't agree on is what 
pre-existing binding to repurpose.
Fortunately there are still a few single-key bindings available.

> Maybe better to try finding a key in the 'C-x x' keymap
> (that already contains a line-related binding 'C-x x t'
> `toggle-truncate-lines').

Unfortunately that removes some of the convenience that the command would 
bring. I can't see anyone typing `C-x x d` (for example) 3 times in a row to 
get 3 copies, much less 7 times.

>> * Rectangle duplication is very useful when editing tables or code
>> with similar structure.  Compared to copy-paste, it saves a lot of
>> cursor movement and permits immediate repetition if more than one copy
>> is required.
> 
> Shouldn't rectangle command be on the 'C-x r' keymap?

No, no special binding should be necessary. That's the point. (Several commands 
work specially on an active rectangle.)

> There are already copy-rectangle-as-kill and yank-rectangle.
> OTOH, it seems 'M-w C-y' already can duplicate rectangle
> regions?

Not nearly as conveniently. Try it and you'll see.
- You can make another copy immediately without having to move the cursor, just 
by pressing the key again.
- You keep the marked rectangle for any operation (cut, copy, delete, etc).
- You keep the kill-ring unmodified for your own purposes.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]