Subject: bug#32672: 27.0.50; image resize on window resizing

From: Juri Linkov <[email-masked]>
Date: Tue, 18 Sep 2018 01:35:27 +0300

>> I tried but the hook still not called.  Moreover, it broke something:
>> after `C-x <right>' I need to type `C-x <left>' twice to get back
>> to the original buffer.
>
> Suppose with emacs -Q I load the following code:
>
> (defvar count 0)
>
> (defun foo ()
>   (setq count (1+ count))
>   (message "%s ... current: %s ... window-buffer: %s"
> 	   count (current-buffer) (window-buffer)))
>
> (with-current-buffer "*scratch*"
>   (add-hook 'buffer-list-update-hook 'foo nil t))
>
> This gets me an initial
>
> 1 ... current: *scratch* ... window-buffer: *scratch*
>
> When I now type C-x <right> and then C-x <left> I get
>
> 2 ... current: *scratch* ... window-buffer: *scratch*
>
> and my window shows *scratch*.  What do you get?

Please try with more buffers than initial 2 (*scratch* and *Messages*),
e.g. with *info* (just `C-h i'), I get

1 ... current: *scratch* ... window-buffer: *scratch*
2 ... current: *scratch* ... window-buffer: *info*

which is in an inconsistent state,
and after typing `q' the hook is called 3 times

3 ... current: *scratch* ... window-buffer: *scratch*
4 ... current: *scratch* ... window-buffer: *scratch*
5 ... current: *scratch* ... window-buffer: *scratch*

And there is the workflow how to break the correct order
of `C-x <right> C-x <left>':

1. Create *info* buffer: `C-h i' and quit `q'
2. Split windows `C-x 2' or `C-x 3' (both windows display *scratch*)
3. Check that `C-x <right> C-x <left>' correctly returns to the original
   buffer *scratch* in the first window.
4. After `C-x o' in another window `C-x <right> C-x <left>'
   doesn't return to the original buffer *scratch*.
   It displays *info*.