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

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

bug#46621: Copy line


From: Juri Linkov
Subject: bug#46621: Copy line
Date: Thu, 23 Jun 2022 20:35:58 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> We need experience of how it feels in practice.  That is, bind the
> command to a convenient key in your init.el and try remember to use it
> while editing.  Note where it works as desired and where not.
>
> Some of what I found:
>
> * Having the cursor remain in the same column is very useful as it's
> usually near the spot to be edited in the original or copied line.
> Automatically moving it to the beginning or end of the line would make
> it worse.

I agree that keeping the same column would be more useful.

> * Whether it is better to keep the cursor on the first line (as if
> duplicating downwards) or the last line (as if duplicating upwards) is less
> clear. It basically comes down to whether it is more common to want
> a similar but different line above or below the original line. I weakly
> favour the current design because it generalises better and it's slightly
> more convenient to edit a sequence of lines top-down than bottom-up.

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.

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

> * 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?
There are already copy-rectangle-as-kill and yank-rectangle.
OTOH, it seems 'M-w C-y' already can duplicate rectangle
regions?





reply via email to

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