Subject: bug#73407: 31.0.50; Add diff-discard-hunk

From: Eli Zaretskii <[email-masked]>
Date: Tue, 24 Sep 2024 15:21:42 +0300

> Cc: [email-masked]
> From: Sean Whitton <[email-masked]>
> Date: Tue, 24 Sep 2024 09:40:30 +0100
> 
> +@findex diff-discard-hunk
> +@item C-c C-k
> +Reverse-apply this hunk to the target file, and then kill it
> +(@code{diff-discard-hunk}).  Unless the buffer visiting the target file
> +was already modified, save it.

We should come up with a better name for this command.
diff-discard-hunk tells me the command will discard the hunk, but says
nothing about applying it, let alone reverse-applying it.  How about
diff-revert-hunk, or maybe diff-revert-and-discard?

> +This command is useful in buffers generated by @w{@kbd{C-x v =}} and
> +@w{@kbd{C-x v D}} (@pxref{Old Revisions}).  You can use this command to
> +remove hunks you never intend to commit, such as temporary debug prints,
> +and the like.

This text could also use some clarification: "remove hunks you never
intended to commit" only hints on what it actually does.  A better
description would be something like "undo some of the changes you made
that you didn't intend".  I wouldn't mention "commit" at all, since
AFAIU this command is not specific to VC and doesn't require a VCS.

> -           (message "%d hunks failed; no buffers changed" failures)))))
> +           (message "%d hunks failed; no buffers changed" failures)
> +           failures))))

This comes from existing text, but still: what does the above say when
there's only 1 failure? does it say "1 hunks failed"?  If so, can we
improve the handling of singular/plural here?

Thanks.