[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#66061: 30.0.50; [PATCH] diff-buffer-with-file should reverse the ord
From: |
Bob Rogers |
Subject: |
bug#66061: 30.0.50; [PATCH] diff-buffer-with-file should reverse the order if the file is modified |
Date: |
Mon, 18 Sep 2023 09:03:37 -0700 |
From: Eli Zaretskii <eliz@gnu.org>
Date: Mon, 18 Sep 2023 13:47:39 +0300
> From: Bob Rogers <rogers@rgrjr.com>
> Date: Sun, 17 Sep 2023 16:54:41 -0700
>
> . . .
>
> The attached patch reverses the order of the arguments to diff only
> when the buffer is unmodified. Either the file has changed on disk, in
> which case it is probably newer, or it hasn't, in which case the diff
> will be empty anyway so the order doesn't matter (and that saves
> checking the actual file mod time).
I don't think we can automatically always reverse them in this case.
Here's a simple case where we shouldn't:
. visit a file
. make some edits
. save the buffer to the file
. copy from the backup file (or some other previous version) over
the edited file on disk
I thought of that, but figured this was a much less likely scenario, and
could be ignored for the sake of getting closer to the right thing.
I think only the user knows what is "old" and what is "new". We
should, of course, allow the user to reverse them, but we shouldn't
reverse automatically.
Fair enough. I suppose M-x diff-reverse-direction is not that much
extra trouble. (I should probably find a keybinding for it.)
-- Bob