I have a function
(defun bad-fn ()
(interactive)
(split-window-right)
(windmove-right)
)
If I go to a frame with just one window visiting EXWM buffer A (and buffer B is next), and call
split-window-right
windmove-right
Manually with M-x, I have A to the left of B, and B is the selected window.
If I use the above function, I have B to the left of A, and A is the selected window.
Changing the above to
(defun bad-fn ()
(interactive)
(split-window-right)
(sit-for 0.5)
(windmove-right)
)
fixes things.
Emacs version info: "GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.17.3) of 2020-08-28"
As a note, I don't think this happened in Emacs 26.3.