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

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

bug#46621: Copy line


From: Howard Melman
Subject: bug#46621: Copy line
Date: Sun, 21 Feb 2021 18:04:00 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin)

Juri Linkov <juri@linkov.net> writes:

>> Once in a while I want to do that.  It is easy: C-a C-k C-k,
>> they C-y as many times as needed.

I do this occasionally.  Usually it's in something like
markdown-mode.  Typically I'm creating lists and want to
write out a bunch of formatting characters before going back
and filling in text.  So I might want 10-12 lines like:

    - [ ]

which is a markdown list item with a checkbox, before going
back and filing in text without having to type odd
punctuation characters.  Sometimes I might put a date string
in there too or some other prefix string.

It's emacs I can do this many different ways.  I might do
the C-a C-k C-k C-y C-y ... dance.  Typically I'll make 4
lines then kill those 4 lines and yank them 3 times.  I
might just type my text and then go back and use
string-rectangle to insert the markup.  If it were more
involved I might use a macro.

If there were a duplicate-line command that took an arg to
duplicate it arg times I'd probably start using that.  I
probably wouldn't bother to write it myself (I haven't in
30+ years).

>> Instead of a command to duplicate the current line repeatedly,
>> how about a command to yank the current kill repeatedly?
>> That would be useful in a much broader range of situations.
>>
>> I wonder if the current meaning of the numeric argument to C-y (reach
>> back in the kill ring) is actually useful.  Would it be better for
>> it to repeat the yank in this way?
>
> It's not realistic to change the meaning of the numeric arg to C-y.
> People already use the current meaning for decades.

Actually, I'd like that and this is a place where I think
completion systems influence that decision.

I don't use an arg to C-y.  If I want something from the
kill-ring that isn't the last thing, I'll C-y and then M-y
until I get it.  I'm not remembering I want the 3rd to last
thing I killed and if I'm off by one I think it's a pain to
fix.  I might do that if I were writing a complex keyboard
macro and concentrating for it but I'd probably use
registers instead.

But in particular with modern completion systems I'd
definitely like this change to yank's arg.  While I do C-y
M-y for simple stuff, if I want something I've yanked from
longer ago, instead I'll use something like consult-yank or
counsel-yank.  These use the kill-region as completion
candidates and show the candidates, one per line, in the
minibuffer with all the completion tools available (most
have options to cope with multi-line text).  I bind it to
M-y globally so if I want to yank something old I skip C-y
entirely and just type M-y and then might use completion and
narrowing if I don't see it near the top of the list.  As a
result, the current arg to C-y is useless to me because
completion offers a much better experience.

-- 

Howard






reply via email to

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