unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Zachary Kanfer <zkanfer@gmail.com>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: 64185@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
	me@eshelyaron.com, Juri Linkov <juri@linkov.net>
Subject: bug#64185: proposal for new function: copy-line
Date: Sat, 24 Jun 2023 23:45:52 -0400	[thread overview]
Message-ID: <CAFXT+ROoE3W=t6MHK1J2LwCEmBdYSVv7X5-qtVBmeYTWz5cd3Q@mail.gmail.com> (raw)
In-Reply-To: <4C83E2DA-FE5F-4191-88CD-7E70008C9892@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2268 bytes --]

>  And I agree that allowing any integer as value isn't necessary the best
choice here. It's a false flexibility; nobody will ever set it to something
other than 0, 1 or -1. Symbols would probably be better, for several
reasons.

I agree. The reasons I can think of are as follows:

1. These values will be read far more often than they are written. A symbol
like 'last is somewhat self-documenting. On the other hand, what is 1? Is
it the old line, because it's highest up on the screen? Is it the last new
line, because the last new line has the greatest point, and 1 is the
greatest of the options? (In the current implementation, it's the first new
line. Did you know that until I mentioned it?) The values have to be
recalled each time they are used.
2. These settings aren't really integers. We won't want to add, multiply,
subtract or divide them.
3. Using integers leads to more complicated code. The current patch has a
line (unless (< duplicate-line-final-position 0) ...). I believe this would
be easier to read as (unless (equal duplicate-line-final-position 'last)
...).

On Fri, Jun 23, 2023 at 5:08 AM Mattias Engdegård <
mattias.engdegard@gmail.com> wrote:

> >  'duplicate-dwim' duplicates the region if it is active.  If not, it
> >  works like 'duplicate-line'.  An active rectangular region is
> > -duplicated on its right-hand side.
> > +duplicated on its right-hand side.  The new user option
> > +'duplicate-line-final-position' specifies where to move point
> > +after duplicating the line.
>
> This makes it unclear to what extent the variable affects
> `duplicate-dwim`. (For some reason it only does so when the region is
> inactive, which doesn't seem right.)
>
> And I agree that allowing any integer as value isn't necessary the best
> choice here. It's a false flexibility; nobody will ever set it to something
> other than 0, 1 or -1. Symbols would probably be better, for several
> reasons.
>
> Finally, it's a bit surprising that this is even discussed for inclusion
> in Emacs 29 at this stage, given the raw state of the design. What about we
> do a proper job on master instead, instead of rushing a half-baked new
> feature into a branch that is already deep into pre-release?
>
>

[-- Attachment #2: Type: text/html, Size: 2711 bytes --]

  parent reply	other threads:[~2023-06-25  3:45 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20  5:07 bug#64185: proposal for new function: copy-line Zachary Kanfer
2023-06-20  6:15 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-20 11:44   ` Eli Zaretskii
2023-06-22  3:33     ` Zachary Kanfer
2023-06-22  5:08       ` Eli Zaretskii
2023-06-22  6:57         ` Juri Linkov
2023-06-22 16:25           ` Eli Zaretskii
2023-06-22 17:27             ` Juri Linkov
2023-06-22 17:45               ` Eli Zaretskii
2023-06-22 18:13                 ` Drew Adams
2023-06-22 18:29                   ` Juri Linkov
2023-06-22 18:42                     ` Drew Adams
2023-06-22 18:52                       ` Juri Linkov
2023-06-22 19:05                         ` Drew Adams
2023-06-22 18:17                 ` Juri Linkov
2023-06-22 18:30                   ` Eli Zaretskii
2023-06-23  5:46                     ` Zachary Kanfer
2023-06-23  5:56                       ` Eli Zaretskii
2023-06-23  7:08                   ` Robert Pluim
2023-06-23  7:19                     ` Eli Zaretskii
2023-06-23  9:01                       ` Robert Pluim
2023-06-23 16:46                       ` Juri Linkov
2023-06-23  9:07 ` Mattias Engdegård
2023-06-23 10:28   ` Eli Zaretskii
2023-06-23 10:50     ` Mattias Engdegård
2023-06-23 11:07       ` Eli Zaretskii
2023-06-23 16:45   ` Juri Linkov
2023-06-24 11:29     ` Mattias Engdegård
2023-06-25 17:24       ` Juri Linkov
2023-06-25 19:46         ` Mattias Engdegård
2023-06-26 17:37           ` Juri Linkov
2023-06-26 17:56             ` Drew Adams
2023-06-26 18:35             ` Eli Zaretskii
2023-06-27 15:35             ` Mattias Engdegård
2023-06-27 18:28               ` Juri Linkov
2023-06-28 13:17                 ` Mattias Engdegård
2023-06-28 17:42                   ` Juri Linkov
2023-06-28 18:37                     ` Eli Zaretskii
2023-06-29  7:13                       ` Juri Linkov
2023-06-30 17:13                         ` Mattias Engdegård
2023-06-30 19:03                           ` Eli Zaretskii
2023-07-01  8:45                             ` Mattias Engdegård
2023-07-01  9:53                               ` Eli Zaretskii
2023-07-01 10:07                                 ` Mattias Engdegård
2023-07-01 10:22                                   ` Eli Zaretskii
2023-07-01 10:33                                     ` Mattias Engdegård
2023-06-25  3:45   ` Zachary Kanfer [this message]
2023-06-25 17:19     ` Juri Linkov
     [not found]       ` <CAFXT+RPRwpZgfPKsyz22+-v6vy7RJwyuwaOEkmunc2MAMSoqZA@mail.gmail.com>
     [not found]         ` <86h6qut970.fsf@mail.linkov.net>
2023-06-26 19:18           ` Zachary Kanfer
2023-06-27  2:25             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFXT+ROoE3W=t6MHK1J2LwCEmBdYSVv7X5-qtVBmeYTWz5cd3Q@mail.gmail.com' \
    --to=zkanfer@gmail.com \
    --cc=64185@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=mattias.engdegard@gmail.com \
    --cc=me@eshelyaron.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).