Function: windmove-swap-states-in-direction
windmove-swap-states-in-direction is a byte-compiled function defined
in windmove.el.gz.
Signature
(windmove-swap-states-in-direction DIR)
Documentation
Swap the states of the selected window and the window at direction DIR.
When windmove-wrap-around is non-nil, takes the window
from the opposite side of the frame.
Probably introduced at or before Emacs version 27.1.
Source Code
;; Defined in /usr/src/emacs/lisp/windmove.el.gz
;;; Directional window swap states
(defun windmove-swap-states-in-direction (dir)
"Swap the states of the selected window and the window at direction DIR.
When `windmove-wrap-around' is non-nil, takes the window
from the opposite side of the frame."
(let ((other-window (window-in-direction dir nil windmove-allow-all-windows
nil windmove-wrap-around 'nomini)))
(cond ((or (null other-window) (window-minibuffer-p other-window))
(user-error "No window %s from selected window" dir))
((window-minibuffer-p (selected-window))
(user-error "Can't swap window with the minibuffer"))
(t
(window-swap-states nil other-window)))))