Function: windmove-do-window-select

windmove-do-window-select is a byte-compiled function defined in windmove.el.gz.

Signature

(windmove-do-window-select DIR &optional ARG WINDOW)

Documentation

Move to the window at direction DIR as seen from WINDOW.

DIR, ARG, and WINDOW are handled as by windmove-find-other-window. If no window is at direction DIR, an error is signaled. If windmove-create-window is a function, call that function with DIR, ARG and WINDOW. If it is non-nil, try to create a new window in direction DIR instead.

Source Code

;; Defined in /usr/src/emacs/lisp/windmove.el.gz
;; Selects the window that's hopefully at the location returned by
;; `windmove-find-other-window', or screams if there's no window there.
(defun windmove-do-window-select (dir &optional arg window)
  "Move to the window at direction DIR as seen from WINDOW.
DIR, ARG, and WINDOW are handled as by `windmove-find-other-window'.
If no window is at direction DIR, an error is signaled.
If `windmove-create-window' is a function, call that function with
DIR, ARG and WINDOW.  If it is non-nil, try to create a new window
in direction DIR instead."
  (let ((other-window (windmove-find-other-window dir arg window)))
    (when (and windmove-create-window
               (or (null other-window)
                   (and (window-minibuffer-p other-window)
                        (not (minibuffer-window-active-p other-window)))))
      (setq other-window (if (functionp windmove-create-window)
                             (funcall windmove-create-window dir arg window)
                           (split-window window nil dir))))
    (cond ((null other-window)
           (user-error "No window %s from selected window" dir))
          ((and (window-minibuffer-p other-window)
                (not (minibuffer-window-active-p other-window)))
           (user-error "Minibuffer is inactive"))
          ((eq other-window 'no-select))
          (t
           (select-window other-window)))))