Subject: bug#68235: 29.1.90; Switching tabs stops following process output in selected window

From: Juri Linkov <[email-masked]>
Date: Tue, 06 Feb 2024 20:03:35 +0200

>> Is 'keep-windows' doable for 'window-state-put' as well?
>
> I attach a patch that adds a fourth argument to 'window-state-put'.  It
> and a new 'set-window-configuration' now use a new function I called
> 'marker-last-position' that returns the last position of a marker even
> after its buffer was killed.

Thanks, will test it.

> The patch also fixes a bug in 'window--state-put-2' that can be
> reproduced with the following simple scenario
>
> (let ((buffer (get-buffer-create "*foo*"))
>       state)
>   (pop-to-buffer buffer)
>   (setq state (window-state-get))
>   (kill-buffer buffer)
>   (window-state-put state))
>
> Did you never see it?

I have seen it when created the first version of the test case:

  (let (ws)
    (pop-to-buffer "*Messages*")
    (setq ws (window-state-get))
    (kill-buffer "*Messages*")
    (window-state-put ws))

But then added both 'writable' to 'window-state-get'
and at the same time 'safe' to 'window-state-put':

  (let (ws)
    (pop-to-buffer "*Messages*")
    (setq ws (window-state-get nil 'writable))
    (kill-buffer "*Messages*")
    (window-state-put ws nil 'safe))

And it didn't fail anymore, so I assumed that
'safe' fixed it ;-)

But now I see that actually 'writable' "fixed" it.