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

From: "Paul D. Nelson" <[email-masked]>
Date: Tue, 08 Apr 2025 09:25:17 +0200

Hi Sean,

>>>> I hadn't thought about automatic detection along the lines that you
>>>> suggest.  I think I'm happy to leave that for now, either to a
>>>> refinement of this command or a future one.
>>>
>>> To be honest, I don't like adding a command where the normal way to use
>>> it is to spam C-u.  The normal way to use it should be easy to access.
>>> So let's try to think of something better.
>>
>> Agreed.
>>
>> Thinking further, this scenario seems niche rather than normal.  The
>> original intent might be met more directly by some new command such as
>> revert-buffer-in-region, diff-buffer-with-file-in-region,
>> vc-diff-in-region, diff-backup-in-region, (...).
>>
>> The situation resembles that of the undo command itself.  Typically, we
>> should either undo small amounts, or resort to one of the structural
>> undo-like commands tied to file or VC status.  Only rarely should we
>> need to do something like C-99 C-/ (possibly in a region), but that
>> option remains a useful fallback.
>
> So just to confirm, we both think that it would be good to come up with
> a different command to satisfy the original use cases, because doing it
> with ediff-undo and diff-with-undo requires spamming C-u, and that's
> unergonomic?  (I ask because you posted an updated patch after writing
> the above).

To clarify, by "original intent", I was referring to your suggestion of
detecting automatically how far back to undo.  The C-u spamming is
relevant in an edge case, not the typical use case for ediff-undo and
diff-with-undo.  It's analogous to how for regular undo, it's
occasionally useful to do C-999 C-/.  In my view, the current patch
meets its primary goals well, but I'd welcome a broader discussion of
related enhancements or other commands.

> Of your suggestions here, my first thought is that maybe C-x x g could
> start operating only on an active region, if there is one.  That seems
> like a great new feature.

Yes, that sounds excellent.

Paul