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

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

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


From: Zachary Kanfer
Subject: bug#64185: proposal for new function: copy-line
Date: Mon, 26 Jun 2023 15:18:19 -0400

> > The code becomes slightly more verbose this way, but is far easier to read
> > and comprehend. It seems an extremely worthwhile tradeoff to me.
>
> Not sure how often users will read the code of duplicate-line.

Developers will. And it's easier to read with symbols.

On Mon, Jun 26, 2023 at 1:41 PM Juri Linkov <juri@linkov.net> wrote:
>> This might surprise you, but code would be more complicated with symbols.
>> Instead of
>>
>>   (unless (eq duplicate-line-final-position 0)
>>     (forward-line duplicate-line-final-position)
>>
>> it will be
>>
>>   (unless (eq duplicate-line-final-position 'old-original-line)
>>     (when (eq duplicate-line-final-position 'first-copied-duplicate-line)
>>       (forward-line 1))
>>     (when (eq duplicate-line-final-position 'last-copied-duplicate-line)
>>       (forward-line -1))
>
> The code doesn't need the (unless (eq duplicate-line-final-position
> 'old-original-line) ... check. It can be only the two when cases. But
> that's a secondary matter.

I agree.

> The code becomes slightly more verbose this way, but is far easier to read
> and comprehend. It seems an extremely worthwhile tradeoff to me.

Not sure how often users will read the code of duplicate-line.

reply via email to

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