Add optional ALL-FRAMES arfument to count-windows

* lisp/window.el (count-windows): Allow counting the windows on
all frames (bug#42872).
This commit is contained in:
Jen-Chieh Shen 2020-08-18 15:25:21 +02:00 committed by Lars Ingebrigtsen
parent ae098c3e72
commit a9603c77f8

View file

@ -2642,12 +2642,17 @@ and no others."
"Return t if WINDOW is the currently active minibuffer window."
(and (window-live-p window) (eq window (active-minibuffer-window))))
(defun count-windows (&optional minibuf)
(defun count-windows (&optional minibuf all-frames)
"Return the number of live windows on the selected frame.
The optional argument MINIBUF specifies whether the minibuffer
window shall be counted. See `walk-windows' for the precise
meaning of this argument."
(length (window-list-1 nil minibuf)))
window is included in the count.
If ALL-FRAMES is non-nil, count the windows in all frames instead
just the selected frame.
See `walk-windows' for the precise meaning of this argument."
(length (window-list-1 nil minibuf all-frames)))
;;; Resizing windows.
(defun window--size-to-pixel (window size &optional horizontal pixelwise round-maybe)