GNU bug report logs - #72866
[PATCH] Add ediff-copy-all-X-to-Y functions

Previous Next

Package: emacs;

Reported by: Paul Nelson <ultrono <at> gmail.com>

Date: Thu, 29 Aug 2024 06:05:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 31.1

Done: Robert Pluim <rpluim <at> gmail.com>

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 72866 in the body.
You can then email your comments to 72866 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#72866; Package emacs. (Thu, 29 Aug 2024 06:05:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Nelson <ultrono <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 29 Aug 2024 06:05:01 GMT) Full text and rfc822 format available.

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

From: Paul Nelson <ultrono <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Add ediff-copy-all-X-to-Y functions
Date: Thu, 29 Aug 2024 08:03:01 +0200
[Message part 1 (text/plain, inline)]
This patch binds functions in Ediff that copy all changes from one
buffer to another, without having to manually go through each
difference.  Any feedback welcome.

Thanks, best,

Paul
[0001-Add-ediff-copy-all-X-to-Y-functions.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72866; Package emacs. (Sat, 31 Aug 2024 10:34:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Nelson <ultrono <at> gmail.com>
Cc: 72866 <at> debbugs.gnu.org
Subject: Re: bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions
Date: Sat, 31 Aug 2024 13:32:18 +0300
> From: Paul Nelson <ultrono <at> gmail.com>
> Date: Thu, 29 Aug 2024 08:03:01 +0200
> 
> This patch binds functions in Ediff that copy all changes from one
> buffer to another, without having to manually go through each
> difference.  Any feedback welcome.

Can you describe situation(s) where these commands will be useful?

I think all we need to install this is a suitable NEWS entry.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72866; Package emacs. (Sun, 01 Sep 2024 07:03:01 GMT) Full text and rfc822 format available.

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

From: Paul Nelson <ultrono <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 72866 <at> debbugs.gnu.org
Subject: Re: bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions
Date: Sun, 1 Sep 2024 08:59:53 +0200
[Message part 1 (text/plain, inline)]
> > This patch binds functions in Ediff that copy all changes from one
> > buffer to another, without having to manually go through each
> > difference.  Any feedback welcome.
>
> Can you describe situation(s) where these commands will be useful?

I use Ediff to merge documents outside of git, like when
working with someone over email or using a computer program to
refactor code.  Sometimes all changes go one way, say from B to A.
The standard workflow then involves pressing "n" to review and "b" to
apply each change.  When the changes turn out to be mundane, this
leads to repetitive "n b" keystrokes.  The proposed patch allows a
more efficient process: rapidly review with "n", then apply all at
once using "C-c C-b".

>
> I think all we need to install this is a suitable NEWS entry.
>
> Thanks.

I've updated the patch with a NEWS entry (formatted to the best of my
ability), together with updates to the Ediff manual and the internal
help system.  Happy to revise further if I missed anything.

Thanks, best,

Paul
[0001-Add-ediff-copy-all-X-to-Y-functions.patch (application/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72866; Package emacs. (Mon, 02 Sep 2024 10:35:01 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Paul Nelson <ultrono <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 72866 <at> debbugs.gnu.org
Subject: Re: bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions
Date: Mon, 02 Sep 2024 12:32:42 +0200
>>>>> On Sun, 1 Sep 2024 08:59:53 +0200, Paul Nelson <ultrono <at> gmail.com> said:

    >> > This patch binds functions in Ediff that copy all changes from one
    >> > buffer to another, without having to manually go through each
    >> > difference.  Any feedback welcome.
    >> 
    >> Can you describe situation(s) where these commands will be useful?

    Paul> I use Ediff to merge documents outside of git, like when
    Paul> working with someone over email or using a computer program to
    Paul> refactor code.  Sometimes all changes go one way, say from B to A.
    Paul> The standard workflow then involves pressing "n" to review and "b" to
    Paul> apply each change.  When the changes turn out to be mundane, this
    Paul> leads to repetitive "n b" keystrokes.  The proposed patch allows a
    Paul> more efficient process: rapidly review with "n", then apply all at
    Paul> once using "C-c C-b".

The functionality seems useful. I wonder if it makes more sense to
have them triggered by the prefix arg, eg "C-u b", "C-u a b",
etc. rather than having to keep Ctrl pressed.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72866; Package emacs. (Wed, 04 Sep 2024 07:34:02 GMT) Full text and rfc822 format available.

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

From: Paul Nelson <ultrono <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 72866 <at> debbugs.gnu.org
Subject: Re: bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions
Date: Wed, 4 Sep 2024 09:30:58 +0200
[Message part 1 (text/plain, inline)]
Hi Robert,

> The functionality seems useful. I wonder if it makes more sense to
> have them triggered by the prefix arg, eg "C-u b", "C-u a b",
> etc. rather than having to keep Ctrl pressed.
>
> Robert
> --

Many thanks for your suggestion.  I agree that this is a more elegant
approach, which also admits a simpler implementation.  I've attached
my revised patch.  Any further feedback welcome.

Thanks, best,

Paul
[0001-Add-Ediff-feature-for-copying-all-differences.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72866; Package emacs. (Wed, 04 Sep 2024 13:04:02 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Paul Nelson <ultrono <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 72866 <at> debbugs.gnu.org
Subject: Re: bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions
Date: Wed, 04 Sep 2024 15:01:23 +0200
>>>>> On Wed, 4 Sep 2024 09:30:58 +0200, Paul Nelson <ultrono <at> gmail.com> said:

    Paul> Many thanks for your suggestion.  I agree that this is a more elegant
    Paul> approach, which also admits a simpler implementation.  I've attached
    Paul> my revised patch.  Any further feedback welcome.

Minor comments below

    Paul> Thanks, best,

    Paul> Paul

    Paul> From 91ade3effdbf19b7d8793020a1c31a4ff791a58d Mon Sep 17 00:00:00 2001
    Paul> From: Paul Nelson <ultrono <at> gmail.com>
    Paul> Date: Wed, 4 Sep 2024 09:24:25 +0200
    Paul> Subject: [PATCH] Add Ediff feature for copying all differences

    Paul> * lisp/vc/ediff-util.el (ediff-diff-to-diff): With universal
    Paul> prefix, copy all differences.

    Paul> * doc/misc/ediff.texi (Quick Help Commands):
    Paul> * etc/NEWS: (Lisp Changes in Emacs 31.1): Document the new
    Paul> feature.
    Paul> ---
    Paul>  doc/misc/ediff.texi   | 26 ++++++++++++++------------
    Paul>  etc/NEWS              | 16 ++++++++++++++++
    Paul>  lisp/vc/ediff-util.el | 29 +++++++++++++++++------------
    Paul>  3 files changed, 47 insertions(+), 24 deletions(-)

    Paul> diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi
    Paul> index 749025c870b..6afb38e3fae 100644
    Paul> --- a/doc/misc/ediff.texi
    Paul> +++ b/doc/misc/ediff.texi
    Paul> @@ -489,15 +489,16 @@ Quick Help Commands
    Paul>  @item a
    Paul>  @kindex a
    Paul>  @emph{In comparison sessions:}
    Paul> -Copies the current difference region (or the region specified as the prefix
    Paul> -to this command) from buffer A to buffer B@.
    Paul> -Ediff saves the old contents of buffer B's region; it can
    Paul> -be restored via the command @kbd{rb}, which see.
    Paul> +Copies the current difference region (or the region specified as the
    Paul> +prefix to this command, or @emph{all} regions with @kbd{C-u} prefix)
    Paul> +from buffer A to buffer B@.  Ediff saves the old contents of buffer B's
    Paul> +region; it can be restored via the command @kbd{rb}, which see.

'numerical prefix' maybe? Although that part of the text is not new.

    Paul>  @emph{In merge sessions:}
    Paul> -Copies the current difference region (or the region specified as the prefix
    Paul> -to this command) from buffer A to the merge buffer.  The old contents of
    Paul> -this region in buffer C can be restored via the command @kbd{r}.
    Paul> +Copies the current difference region (or the region specified as the
    Paul> +prefix to this command, or @emph{all} regions with @kbd{C-u} prefix)
    Paul> +from buffer A to the merge buffer.  The old contents of this region in
    Paul> +buffer C can be restored via the command @kbd{r}.

Similarly here

    Paul>  @item b
    Paul>  @kindex b
    Paul> @@ -511,11 +512,12 @@ Quick Help Commands
 
    Paul>  @item ab
    Paul>  @kindex ab
    Paul> -Copies the current difference region (or the region specified as the prefix
    Paul> -to this command) from buffer A to buffer B@.  This (and the next five)
    Paul> -command is enabled only in sessions that compare three files
    Paul> -simultaneously.  The old region in buffer B is saved and can be restored
    Paul> -via the command @kbd{rb}.
    Paul> +Copies the current difference region (or the region specified as the
    Paul> +prefix to this command, or @emph{all} regions with @kbd{C-u} prefix)
    Paul> +from buffer A to buffer B@.  This (and the next five) command is enabled
    Paul> +only in sessions that compare three files simultaneously.  The old
    Paul> +region in buffer B is saved and can be restored via the command
    Paul> +@kbd{rb}.

and here.

    Paul>  @item ac
    Paul>  @kindex ac
    Paul>  Copies the difference region from buffer A to buffer C@.
    Paul> diff --git a/etc/NEWS b/etc/NEWS
    Paul> index f10f9ae4d65..a6db0c96288 100644
    Paul> --- a/etc/NEWS
    Paul> +++ b/etc/NEWS
    Paul> @@ -121,6 +121,22 @@ A new ':authorizable t' parameter has been added to 'dbus-call-method'
    Paul>  and 'dbus-call-method-asynchronously' to allow the user to interactively
    Paul>  authorize the invoked D-Bus method (e.g., via polkit).
 
    Paul> ++++
    Paul> +** Ediff's copy commands now apply to all changes with 'C-u' prefix.
    Paul> +The Ediff copy commands, bound to 'a', 'b', 'ab', etc., now copy all
    Paul> +changes when supplied with a universal prefix argument via 'C-u':
    Paul> +
    Paul> +- 'C-u a' copies all changes from buffer A to buffer B (in 2-way diff)
    Paul> +  or to buffer C (in 3-way diff or merge).
    Paul> +- 'C-u b' copies all changes from buffer B to buffer A (in 2-way diff)
    Paul> +  or to buffer C (in 3-way diff or merge).
    Paul> +- 'C-u a b' copies all changes from buffer A to buffer B.
    Paul> +- 'C-u b a' copies all changes from buffer B to buffer A.
    Paul> +- 'C-u a c' copies all changes from buffer A to buffer C.
    Paul> +- 'C-u b c' copies all changes from buffer B to buffer C.
    Paul> +- 'C-u c a' copies all changes from buffer C to buffer A.
    Paul> +- 'C-u c b' copies all changes from buffer C to buffer B.
    Paul> +

You should add an '** Ediff' section to 'Changes in Specialized Modes
and Packages in Emacs 31.1' and put this change there.

    Paul>  
    Paul>  * Changes in Emacs 31.1 on Non-Free Operating Systems
 
    Paul> diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
    Paul> index 597d8a5e643..c2cdf7d4e5e 100644
    Paul> --- a/lisp/vc/ediff-util.el
    Paul> +++ b/lisp/vc/ediff-util.el
    Paul> @@ -1891,7 +1891,7 @@ ediff-diff-at-point
    Paul>  (defun ediff-diff-to-diff (arg &optional keys)
    Paul>    "Copy buffer-X'th difference region to buffer Y (X,Y are A, B, or C).
    Paul>  With numerical prefix argument ARG, copy the difference specified
    Paul> -in the arg.
    Paul> +in the arg.  With prefix `C-u', copy all differences.

In docstrings `C-u' is written `\\[universal-argument]' (not that Iʼve
ever been tempted to change it from `C-u' :-))

Eli, does this change need a copyright assigment? I donʼt see
'ultrono <at> gmail.com' in the git logs anywhere.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72866; Package emacs. (Wed, 04 Sep 2024 13:13:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 72866 <at> debbugs.gnu.org, ultrono <at> gmail.com
Subject: Re: bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions
Date: Wed, 04 Sep 2024 16:10:46 +0300
> From: Robert Pluim <rpluim <at> gmail.com>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  72866 <at> debbugs.gnu.org
> Date: Wed, 04 Sep 2024 15:01:23 +0200
> 
> Eli, does this change need a copyright assigment? I donʼt see
> 'ultrono <at> gmail.com' in the git logs anywhere.

Paul's assignment is on file, so we are okay in that department.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72866; Package emacs. (Wed, 04 Sep 2024 13:24:02 GMT) Full text and rfc822 format available.

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

From: Paul Nelson <ultrono <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Robert Pluim <rpluim <at> gmail.com>, 72866 <at> debbugs.gnu.org
Subject: Re: bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions
Date: Wed, 4 Sep 2024 15:20:46 +0200
[Message part 1 (text/plain, inline)]
Thanks Robert, I've implemented your suggestions.

I hope someone will check that I've used "+++" correctly in NEWS,
affirming that I updated the documentation -- hopefully I didn't miss
anything.

Any other comments welcome.

Paul
[0001-Add-Ediff-feature-for-copying-all-differences.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72866; Package emacs. (Wed, 11 Sep 2024 08:48:02 GMT) Full text and rfc822 format available.

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

From: Robert Pluim <rpluim <at> gmail.com>
To: Paul Nelson <ultrono <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 72866 <at> debbugs.gnu.org
Subject: Re: bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions
Date: Wed, 11 Sep 2024 10:46:34 +0200
tags 72866 fixed
close 72866 31.1
quit

>>>>> On Wed, 4 Sep 2024 15:20:46 +0200, Paul Nelson <ultrono <at> gmail.com> said:

    Paul> Thanks Robert, I've implemented your suggestions.
    Paul> I hope someone will check that I've used "+++" correctly in NEWS,
    Paul> affirming that I updated the documentation -- hopefully I didn't miss
    Paul> anything.

Looks fine to me. I slightly adjusted your commit message and added
the bug number to it.

Closing.
Committed as 833158c0b78

Robert
-- 




Added tag(s) fixed. Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 11 Sep 2024 08:48:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 31.1, send any further explanations to 72866 <at> debbugs.gnu.org and Paul Nelson <ultrono <at> gmail.com> Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 11 Sep 2024 08:48:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 09 Oct 2024 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 258 days ago.

Previous Next


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