Subject: Re: bug#32850: 27.0.50; window-swap-states doesn't swap window prev/next-buffers

From: martin rudalics <[email-masked]>
Date: Mon, 19 Nov 2018 10:42:10 +0100

>>> Right, we need to support prefix args of C-x <left> and C-x <right>.
 >>
 >> Could you do that please?
 >
 > Like this?

I doubt that

!         (while (<= 0 (setq arg (1- arg)))
!           (switch-to-next-buffer))))))

and

!         (while (<= 0 (setq arg (1- arg)))
!           (switch-to-prev-buffer))))))

will DTRT.  They pretend that all these buffers were actually shown in
the window and thus "presented" to the user.  As a consequence,
switching from a buffer B to the fourth previous buffer and
subsequently switching to the next buffer would not get us back to B
but to the third previous buffer of B at the time we switched to the
previous buffer.  I suppose you won't like that.

What we should probably do instead here is to get the fourth buffer of
what 'window-prev-buffers' returns and try to switch to that buffer
either via 'switch-to-buffer' or 'pop-to-buffer-same-window'.

martin