GNU bug report logs - #56418
Add duplicate-dwim [PATCH]

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Wed, 6 Jul 2022 08:30:02 UTC

Severity: wishlist

Tags: patch

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56418 in the body.
You can then email your comments to 56418 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Wed, 06 Jul 2022 08:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mattias Engdegård <mattiase <at> acm.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 06 Jul 2022 08:30:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattiase <at> acm.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Add duplicate-dwim [PATCH]
Date: Wed, 6 Jul 2022 10:29:29 +0200
[Message part 1 (text/plain, inline)]
This patch adds duplicate-swim, a command that works like duplicate-line but works on the region if active. It corresponds exactly to upcase-dwim, downcase-dwim and capitalize-dwim which have become quite popular.

Rectangular regions are treated specially by duplicating on the right-hand side. This behaviour turns out to be the most convenient one, and is also confluent with that of ordinary regions when the rectangle is only one line tall.

[0001-Add-duplicate-dwim.patch (application/octet-stream, attachment)]

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 06 Jul 2022 10:46:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Fri, 08 Jul 2022 10:06:01 GMT) Full text and rfc822 format available.

Message #10 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattiase <at> acm.org>
To: 56418 <at> debbugs.gnu.org
Subject: bug#56418: Add duplicate-dwim [PATCH]
Date: Fri, 8 Jul 2022 12:05:21 +0200
The patch didn't include any changes to the manual because neither `duplicate-line` nor `upcase-dwim` appear there, but perhaps they should, too? Please advise.





Reply sent to Mattias Engdegård <mattiase <at> acm.org>:
You have taken responsibility. (Tue, 26 Jul 2022 12:27:01 GMT) Full text and rfc822 format available.

Notification sent to Mattias Engdegård <mattiase <at> acm.org>:
bug acknowledged by developer. (Tue, 26 Jul 2022 12:27:01 GMT) Full text and rfc822 format available.

Message #15 received at 56418-done <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattiase <at> acm.org>
To: 56418-done <at> debbugs.gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Tue, 26 Jul 2022 14:26:11 +0200
No objections, which is not surprising given the precedence; pushed to master.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Tue, 26 Jul 2022 12:48:01 GMT) Full text and rfc822 format available.

Message #18 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: 56418 <at> debbugs.gnu.org,
 Mattias Engdegård <mattiase <at> acm.org>
Cc: 56418-done <at> debbugs.gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Tue, 26 Jul 2022 14:46:51 +0200
How about simply replacing 'duplicate-line' with 'duplicate-dwim'?  Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Tue, 26 Jul 2022 12:48:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Tue, 26 Jul 2022 12:58:02 GMT) Full text and rfc822 format available.

Message #24 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Mattias Engdegård <mattiase <at> acm.org>,
 56418 <at> debbugs.gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Tue, 26 Jul 2022 14:56:59 +0200
>>>>> On Tue, 26 Jul 2022 14:46:51 +0200, Stefan Kangas <stefan <at> marxist.se> said:

    Stefan> How about simply replacing 'duplicate-line' with
    Stefan> 'duplicate-dwim'?

I think both have merit, sometimes I just want to duplicate a line
with worrying about the region.

-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Wed, 27 Jul 2022 09:02:02 GMT) Full text and rfc822 format available.

Message #27 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattiase <at> acm.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 56418 <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Wed, 27 Jul 2022 11:01:36 +0200
26 juli 2022 kl. 14.56 skrev Robert Pluim <rpluim <at> gmail.com>:

>    Stefan> How about simply replacing 'duplicate-line' with
>    Stefan> 'duplicate-dwim'?
> 
> I think both have merit, sometimes I just want to duplicate a line
> with worrying about the region.

While I have no particular wish to revisit this now, I will note that:

* Having two functions makes it harder to supply an standard key binding: we would have to select one of them since spending two key bindings is out of the question.

* As many other users I've bound M-u to upcase-dwim (etc) and not once has it bothered me that I can't upcase a word while marking a region.

* I'm not aware of any complaints whatsoever that the standard bindings for M-; and backspace force users to "worry about the region", 

However, peace and consensus is of higher importance and as far as I'm concerned this bug is closed, at least for now.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Wed, 27 Jul 2022 09:03:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Fri, 29 Jul 2022 03:55:02 GMT) Full text and rfc822 format available.

Message #33 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: 56418 <at> debbugs.gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Thu, 28 Jul 2022 23:54:36 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

What is the difference between duplicate-dwim and duplicate-line?

(To minimize duplicate replies, please don't reply unless you're
Mattias.)

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Fri, 29 Jul 2022 06:12:02 GMT) Full text and rfc822 format available.

Message #36 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org
Cc: mattiase <at> acm.org, 56418 <at> debbugs.gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Fri, 29 Jul 2022 09:11:34 +0300
> Cc: 56418 <at> debbugs.gnu.org
> From: Richard Stallman <rms <at> gnu.org>
> Date: Thu, 28 Jul 2022 23:54:36 -0400
> 
> What is the difference between duplicate-dwim and duplicate-line?
> 
> (To minimize duplicate replies, please don't reply unless you're
> Mattias.)

How about dwim replies, do they have to be minimized as well?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Sun, 31 Jul 2022 08:37:02 GMT) Full text and rfc822 format available.

Message #39 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattiase <at> acm.org>
To: rms <at> gnu.org
Cc: 56418 <at> debbugs.gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Sun, 31 Jul 2022 10:36:11 +0200
29 juli 2022 kl. 05.54 skrev Richard Stallman <rms <at> gnu.org>:

> What is the difference between duplicate-dwim and duplicate-line?

Roughly, duplicate-dwim is to duplicate-line as upcase-dwim is to upcase-word. Ie, the -dwim commands operate on the region if active.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Mon, 01 Aug 2022 03:34:01 GMT) Full text and rfc822 format available.

Message #42 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: 56418 <at> debbugs.gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Sun, 31 Jul 2022 23:33:22 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Roughly, duplicate-dwim is to duplicate-line as upcase-dwim is to upcase-word. Ie, the -dwim commands operate on the region if active.

I think there are already several commands that operate on the region
if it is active, otherwise on some other textual unit.  Would it be
bad for duplicate-line to do this?  Then we wouldn't need a separate
duplicate-dwim.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Mon, 01 Aug 2022 11:31:01 GMT) Full text and rfc822 format available.

Message #45 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org
Cc: mattiase <at> acm.org, 56418 <at> debbugs.gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Mon, 01 Aug 2022 14:29:52 +0300
> Cc: 56418 <at> debbugs.gnu.org
> From: Richard Stallman <rms <at> gnu.org>
> Date: Sun, 31 Jul 2022 23:33:22 -0400
> 
>   > Roughly, duplicate-dwim is to duplicate-line as upcase-dwim is to upcase-word. Ie, the -dwim commands operate on the region if active.
> 
> I think there are already several commands that operate on the region
> if it is active, otherwise on some other textual unit.  Would it be
> bad for duplicate-line to do this?  Then we wouldn't need a separate
> duplicate-dwim.

That was suggested, but turned out to be too controversial.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Thu, 04 Aug 2022 04:02:01 GMT) Full text and rfc822 format available.

Message #48 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mattiase <at> acm.org, 56418 <at> debbugs.gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Thu, 04 Aug 2022 00:01:25 -0400
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

I've seen no cogent argument against making `duplicate-line' operate
on the region when that is active.  Someone presented this argument,

    Simen proposed something quite similar (added to the CCs), and my only
    objection was that the semantics of the simpler command is quite
    clear -- it always creates a new line, even if we're at a final line in
    a buffer without a newline.  When dealing with regions, it's not quite
    clear what the semantics should be in those corner cases (i.e., regions
    that doesn't end with a newline)...

but "duplicate the region" is totally clear, if interpreted strictly:

    Not much of a edge case, is it? If you select "bon" and duplicate you =
    end up with "bonbon", as promised.

The practical question is, which way will people find more convenient
to use?

Making `duplicate-line' region-sensitive would enable people to do both
operations with one key binding.  That is clearly a plus.  Good key
bindings are scarce and they take up space in the mind.

Making `duplicate-line' region-sensitive could lead to surprises when
the region is active, for a user who only ever uses it to duplicate
lines.  That is clearly a minus -- but how big is it in practice?

If we can only spare one binding for this, which behavior should that
binding have?

I suggest we define `duplicate-lines' with an option to control
whether it is region-sensitive, so that people can try it both ways
and tell us which way they like better.  Then we could set the
default for that option accordingly.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Thu, 04 Aug 2022 18:44:02 GMT) Full text and rfc822 format available.

Message #51 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattiase <at> acm.org>
To: rms <at> gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>, 56418 <at> debbugs.gnu.org,
 Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Thu, 4 Aug 2022 20:43:33 +0200
4 aug. 2022 kl. 06.01 skrev Richard Stallman <rms <at> gnu.org>:

> I suggest we define `duplicate-lines' with an option to control
> whether it is region-sensitive, so that people can try it both ways
> and tell us which way they like better.

I wouldn't mind but it's not a change I can make unilaterally. The present solution did not require changes to `duplicate-line`.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56418; Package emacs. (Tue, 16 Aug 2022 11:09:01 GMT) Full text and rfc822 format available.

Message #54 received at 56418 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, Eli Zaretskii <eliz <at> gnu.org>,
 56418 <at> debbugs.gnu.org, rms <at> gnu.org
Subject: Re: bug#56418: Add duplicate-dwim [PATCH]
Date: Tue, 16 Aug 2022 13:08:08 +0200
>>>>> On Thu, 4 Aug 2022 20:43:33 +0200, Mattias Engdegård <mattiase <at> acm.org> said:

    Mattias> 4 aug. 2022 kl. 06.01 skrev Richard Stallman <rms <at> gnu.org>:
    >> I suggest we define `duplicate-lines' with an option to control
    >> whether it is region-sensitive, so that people can try it both ways
    >> and tell us which way they like better.

    Mattias> I wouldn't mind but it's not a change I can make unilaterally. The
    Mattias> present solution did not require changes to `duplicate-line`.

Not everything needs an option to control it. I want duplicate-line to
simply duplicate a line. Others donʼt, they want it to obey the
region. We can coexist peacefully without forcing anybody to configure
anything, and we can each have whatever binding we prefer (I donʼt
think this should be bound to a key by default).

Robert
-- 




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 13 Sep 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 281 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.