Function: get-largest-window

get-largest-window is a byte-compiled function defined in window.el.gz.

Signature

(get-largest-window &optional ALL-FRAMES DEDICATED NOT-SELECTED NO-OTHER)

Documentation

Return the largest window on frames specified by ALL-FRAMES.

A minibuffer window is never a candidate. A dedicated window is never a candidate unless DEDICATED is non-nil, so if all windows are dedicated, the value is nil. Optional argument NOT-SELECTED non-nil means never return the selected window. Optional argument NO-OTHER non-nil means to never return a window whose
'no-other-window' parameter is non-nil.

The following non-nil values of the optional argument ALL-FRAMES have special meanings:

- t means consider all windows on all existing frames.

- visible means consider all windows on all visible frames on
  the current terminal.

- 0 (the number zero) means consider all windows on all visible
  and iconified frames on the current terminal.

- A frame means consider all windows on that frame only.

Any other value of ALL-FRAMES means consider all windows on the selected frame and no others.

Probably introduced at or before Emacs version 19.23.

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun get-largest-window (&optional all-frames dedicated not-selected no-other)
  "Return the largest window on frames specified by ALL-FRAMES.
A minibuffer window is never a candidate.  A dedicated window is
never a candidate unless DEDICATED is non-nil, so if all windows
are dedicated, the value is nil.  Optional argument NOT-SELECTED
non-nil means never return the selected window.  Optional
argument NO-OTHER non-nil means to never return a window whose
'no-other-window' parameter is non-nil.

The following non-nil values of the optional argument ALL-FRAMES
have special meanings:

- t means consider all windows on all existing frames.

- `visible' means consider all windows on all visible frames on
  the current terminal.

- 0 (the number zero) means consider all windows on all visible
  and iconified frames on the current terminal.

- A frame means consider all windows on that frame only.

Any other value of ALL-FRAMES means consider all windows on the
selected frame and no others."
  (let ((best-size 0)
	best-window size)
    (dolist (window (window-list-1 nil 'nomini all-frames))
      (when (and (or dedicated (not (window-dedicated-p window)))
		 (or (not not-selected) (not (eq window (selected-window))))
                 (or (not no-other)
                     (not (window-parameter window 'no-other-window))))
	(setq size (* (window-pixel-height window)
		      (window-pixel-width window)))
	(when (> size best-size)
	  (setq best-size size)
	  (setq best-window window))))
    best-window))