Function: windmove-delete-in-direction

windmove-delete-in-direction is a byte-compiled function defined in windmove.el.gz.

Signature

(windmove-delete-in-direction DIR &optional ARG)

Documentation

Delete the window at direction DIR.

If prefix ARG is C-u (universal-argument), also kill the buffer in that window. With M-0 prefix, delete the selected window and select the window at direction DIR. When windmove-wrap-around is non-nil, takes the window from the opposite side of the frame.

Source Code

;; Defined in /usr/src/emacs/lisp/windmove.el.gz
;;; Directional window deletion

(defun windmove-delete-in-direction (dir &optional arg)
  "Delete the window at direction DIR.
If prefix ARG is `\\[universal-argument]', also kill the buffer in that window.
With `M-0' prefix, delete the selected window and
select 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
                                           arg windmove-wrap-around 'nomini)))
    (cond ((null other-window)
           (user-error "No window %s from selected window" dir))
          (t
           (when (equal arg '(4))
             (kill-buffer (window-buffer other-window)))
           (if (not (equal arg 0))
               (delete-window other-window)
             (delete-window (selected-window))
             (select-window other-window))))))