Subject: bug#33258: inhibit-select-window

From: Juri Linkov <[email-masked]>
Date: Wed, 07 Nov 2018 23:32:07 +0200

> You cannot do that in a systematical way - 'display-buffer-alist' is
> agnostic of its clients.  And don't forget clients of 'vc-diff' who
> might rely on the fact that the latter selects the window chosen.

So to rule out non-interactive callers of vc-diff we need to check
for (eq this-command 'vc-diff)?

But there is a simpler and safer solution that I already mentioned:
to restore an original window in post-command-hook.  Or even better
using your new window-state-change-functions: when inhibit-select-window
was found in an alist from display-buffer-alist then check whether
the selected window was changed in an alist of changes provided by
window-state-change-functions and restore an old selected window.