Subject: bug#49057: 28.0.50; windmove-display-in-direction ignores windmove-display-no-select

From: Juri Linkov <[email-masked]>
Date: Thu, 17 Jun 2021 02:08:57 +0300

> Sorry, I forgot to mention that line but it is enabled but I already
> have that in my config. Even with that it is not working fine.

Thanks for clarification, then we have a problem because
pop-to-buffer insists on always selecting the new window
that was displayed:

          ;; Make sure the window is selected (Bug#8615), (Bug#6954)
          (select-window window norecord))

Here is the workflow:

1. switch-to-buffer calls pop-to-buffer-same-window
2. pop-to-buffer-same-window calls pop-to-buffer
3. pop-to-buffer calls display-buffer
4. display-buffer calls display-buffer-override-next-command
   that calls post-function from windmove-display-in-direction
   that selects the old window

5. but later pop-to-buffer selects the new window,
   thus overriding the specified selection of the old window.