Subject: bug#27243: another case: dired-auto-revert-buffer jumps point to beginning of buffer

From: Stephen Berman <[email-masked]>
Date: Mon, 25 May 2020 09:26:38 +0200

On Mon, 25 May 2020 05:51:07 +0200 Michael Heerdegen <[email-masked]> wrote:

> Stephen Berman <[email-masked]> writes:
>
>> > As long as the current behavior doesn't change, it's fine with me.
>>
>> I pushed the fix to master (8e394b082b).
>
> This broke a different use case for me.
>
> I'm using switch-to-buffer-preserve-window-point > t and
> dired-auto-revert-buffer > nil.
>
> Say I have a frame showing the same dired buffer twice, with different
> values of point, in two windows.  When I hit ^ and then RET in
> succession in the first window, I'm back in that buffer but point now
> equals window-point of the second window.  Emacs failed to restore the
> correct value of point.  If I revert this commit which replaced
> `switch-to-buffer' with `pop-to-buffer-same-window' in `find-file', the
> correct value of point is restored as expected.
> `pop-to-buffer-same-window' probably doesn't care about
> `switch-to-buffer-preserve-window-point' at all?

Is this with -Q?  I don't see this with -Q in a build from (not current
but recent) master.  I tried to reproduce what you described as follows:

1. emacs -Q
2. M-: switch-to-buffer-preserve-window-point RET => t
   M-: dired-auto-revert-buffer RET => nil
3. C-x d RET M-: (point) => 211
4. C-x 2 C-x o 10 n M-: (point) => 890
5. C-x o ^ RET M-: (point) => 211
also: 6. C-x o ^ RET M-: (point) => 890

If Emacs behaves as you described, the result in step 5 should have been
890, or have I misunderstood you?

Steve Berman