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

From: Juri Linkov <[email-masked]>
Date: Thu, 22 Nov 2018 01:44:34 +0200

>>> 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').
>>
>> Aren't hooks intended to run only once when the command is finished?
>
> 'post-command-hook' only.  'window-size-change-functions' is currently
> run once for each redisplay.  The three I cited above are run for
> every set_window_buffer when the buffer changes.  Note that you are
> your own client here since you want to pretend that all these buffers
> were indeed displayed.

We could let-bind these hooks to nil in the loop, and let to call them
only for the last 'previous-buffer' call.