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

From: martin rudalics <[email-masked]>
Date: Tue, 20 Nov 2018 10:27:52 +0100

> Why not?  'C-2 C-x <left>' could be just a shortcut for
 > 'C-x <left> C-x <left>'.
 >
 >> 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'.
 >
 > But what if the users don't want to break the chain of
 > previous/next buffers?  For example:
 >
 > [buffer-A] [buffer-B] [buffer-C] [buffer-D] [buffer-E]
 > prev-buffers          current-buffer      next-buffers
 >
 > After 'C-2 C-x <left>' I'd want to have the same sequence of buffers,
 > just changing the current buffer:
 >
 > [buffer-A] [buffer-B] [buffer-C] [buffer-D] [buffer-E]
 > current-buffer                            next-buffers
 >
 > Not what you seems to suggest that takes ARGth previous buffer
 > to display and breaks the order of buffers:
 >
 > [buffer-B] [buffer-C] [buffer-A] [buffer-D] [buffer-E]
 >                        current-buffer
 >
 > IOW, I use 'C-x <left>' and 'C-x <right>' to "scroll" the list
 > of prev/next buffers.

So what you're after is to make the visual effect of C-2 C-x <left>
the same as that of C-x b buffer-A but keep the impact on the lists of
previous buffers and next buffers distinct.  If people are OK with
that I won't insist.

But please describe the behavior in the doc-strings of
'previous-buffer' and 'next-buffer' in sufficient detail.  Also note
that the overhead induced by executing these functions then becomes
proportional to the value of the prefix argument (for each single
switch you call 'set-window-prev-buffers', 'set-window-next-buffers'
'record-window-buffer', 'unrecord-window-buffer' and run
'buffer-list-update-hook', 'window-scroll-functions' and
'window-configuration-change-hook').  Finally note that you change
'buffer-display-time' without actually displaying the buffer and the
mystic last_selected_window slot in buffer.h.

martin