Subject: bug#5352: diff-jump-to-old-file inverts hunk application as well

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 09 May 2022 16:32:11 +0200

Michael Orlitzky <[email-masked]> writes:

> The custom diff-jump-to-old-file causes a reversal of the traditional
> diff/patch behavior present in Emacs <= 22. From diff-mode.el, it seems
> sort of intentional that this is the case; nevertheless, the new
> behavior does not strike me as useful. From diff-mode.el:
>
> (defun diff-apply-hunk (&optional reverse)
>   "Apply the current hunk to the source file and go to the next.
>   By default, the new source file is patched, but if the variable
>   `diff-jump-to-old-file' is non-nil, then the old source file is
>   patched instead (some commands, such as `diff-goto-source' can change
>   the value of this variable when given an appropriate prefix argument).
>
> Why should the default be to patch the new file, which is by definition
> already patched? Take for example,

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I think the logic here is when you have a diff that's been partially
applied, so that the "new" file isn't literally the one you've already
applied the patch to.

In that case, you usually want to apply the hunk to the new file, and
not the old one.

In any case, the current behaviour has been in place for a decade, so I
think it's too late to change it now (because that would break things
for people that's used to the direction it works in now).

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no