Subject: bug#77580: [PATCH] New command ediff-undo

From: Sean Whitton <[email-masked]>
Date: Sun, 13 Apr 2025 11:13:57 +0800

Hello,

On Sat 12 Apr 2025 at 11:15pm +02, Paul D. Nelson wrote:

> Thanks so much for taking the time to think and offer feedback.
>
>>> often that the last undo step is not what you think would be, and you
>>> don't know how far you must look back
>
>> We don't keep a count of buffer changes in our heads so that we could
>> know how many changes back we need to go to get a diff that will
>> contain the information we want.
>
> The proposed commands can be useful when the number of undo steps is 1,
> 2 or infinity.  Examples:
>
> 1. After a buffer reverts because a file changes.
>
> 2. When you need to revert, perhaps just in a region, across file-save
> boundaries without suitable VC or backup endpoints available, or (Juri's
> example) across file and VC boundaries within a session.  (Good reason
> to add the "minus prefix" option -- thanks Juri.)
>
> 3. After any complicated Emacs command.  Suppose you've just done a
> query-replace-regexp with "!" that had unexpected effects.  As an
> alternative to undoing and redoing the query-replace-regexp more
> carefully, you can ediff-undo.  This is really a family of examples, one
> for each complicated Emacs command.
>
> In these cases, the ergonomics seem good to me.

I'm afraid I can't agree.  I'm glad they work out for you, but I'm not
sure they will for others.  For example, if a complicated command or
external process has made large edits to the buffer you might make
further, small edits yourself before even realising that large edits had
been made.  And then you're into counting undo operations again.

-- 
Sean Whitton