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

From: Juri Linkov <[email-masked]>
Date: Mon, 05 Feb 2024 09:17:24 +0200

> I attach a patch.  Note that in my Emacs, window configurations are much
> more lightweight so I cannot reliably test it.  You would have to do all
> the testing yourself.
> [...]
>  DEFUN ("set-window-configuration", Fset_window_configuration,
> -       Sset_window_configuration, 1, 3, 0,
> +       Sset_window_configuration, 1, 4, 0,
> [...]
> -   Lisp_Object dont_set_miniwindow)
> +   Lisp_Object dont_set_miniwindow, Lisp_Object keep_windows)

Is 'keep-windows' doable for 'window-state-put' as well?

It seems windows are deleted here:

      (while window-state-put-stale-windows
	(let ((window (pop window-state-put-stale-windows)))
          ;; Avoid that 'window-deletable-p' throws an error if window
          ;; was already deleted when exiting 'with-temp-buffer' above
          ;; (Bug#54028).
	  (when (and (window-valid-p window)
                     (eq (window-deletable-p window) t))
	    (delete-window window))))

After commenting out the code above, this test doesn't delete windows:

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

So maybe the same option 'keep-windows' could call the same hook
'post-set-window-configuration-functions' from 'window-state-put' too?