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.

Full log


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)






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.