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

From: Juri Linkov <[email-masked]>
Date: Thu, 15 Feb 2024 09:34:33 +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, I tested, and both hooks work nicely.

One problem is that whether to run the hook is defined by the fourth argument.
This means that it a user needs to use the hook, there is no way to change
the fourth argument of the existing function calls in core commands.

Maybe better to keep windows when the hook is not empty?
I.e. something like this for 'window--state-put-2':

  (when window-state-put-keep-window-functions
    ...
    (push (list window old-buffer-or-name start-pos point-pos)
          window-state-put-kept-windows))

> I added a new hook called 'window-state-put-keep-window-functions' with
> the same arguments as 'post-set-window-configuration-functions'.  Maybe
> people wanted to keep them apart.  If you think the hook should be also
> run when there are no "kept" windows, we can do that as well.

Running the hook with an empty list of windows makes sense as well.