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: Wed, 22 Jun 2022 10:28:19 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> This would also mean that the problem is a missing command that
>> saves the current line to the kill-ring?  If such a command existed,
>> then duplicating the line would take two keys as well: the first
>> key to save the current line to the kill-ring, and the second key
>> to yank it.
>
> A command to save the current line to the kill ring might be nice (if it
> settles on some definition of "line"), but it doesn't really offer the
> convenience.
>
> To insert a copy of a region: `M-w C-y'.
>
> To insert a copy of the current line with such a command: `NEW-COMMAND
> C-n' (see if you landed on the next line or whether that took you to the
> end of the buffer) `RET'/`C-a' `C-y'.

Now I realized what's actually missing is a command `mark-line'.
After marking the line it could move point to the beginning of the next line.
Then the key sequence would be `mark-line M-w C-y'.  And the case of
a missing training newline is very rare, so an extra RET is not a problem.

> I.e., `duplicate-line' offers both a practical and mental simplification
> over what we have today, but making that command do region stuff doesn't
> really give anything except muddling up the command semantics.

The above suggestion is just an alternative way to do the same.

BTW, what do you think about the already suggested leaving point
at the end of duplicated lines?  This means removing save-excursion
and adding backward-char to the end of `duplicate-line' to move point
before the last newline.





reply via email to

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