Subject: bug#64185: proposal for new function: copy-line

From: Juri Linkov <[email-masked]>
Date: Mon, 26 Jun 2023 20:37:10 +0300

>> I don't see from where we can get such assumption - e.g. extending
>> the region to the copied text also makes sense.
>
> No, it's actually a firm requirement.  Extending the region would only
> allow making exponentially more copies which is useless in practice.
> Try it yourself and you'll see.

I remember already the need of doing this several times: to create
initial content for testing first I select one line then duplicate
its region, then select the whole buffer and duplicate it again
and so on, so the duplicated region grows exponentially.

>> When the users will request a setting for columns, then we could
>> add a new option e.g. `duplicate-dwim-final-column`.
>
> Request submitted then!

`duplicate-dwim-final-column` should be applied to both cases?
To rectangular regions and to lines?  In case of lines it could
define whether to keep the original column, or move to the
beginning of the line, or to the end of the line?

>> And if the users need to do the same with regions, then a separate
>> option could be added e.g. `duplicate-dwim-final-region`.
>
> How about we, for a change, attempt this thing called design, instead
> of the customary Emacs piecemeal hodgepodge?

Then I think `duplicate-dwim` is a misnomer, and it was misdesigned.
A proper name that matches the design of `thing-at-point`, would be
`duplicate-thing`.  thingatpt.el contains the definition of the region
among many other things that are candidates for duplication.

Since the design of a general thing-duplication command
is still under development, maybe it would be appropriate
to remove `duplicate-dwim` from emacs-29, and continue
its development in master?