Function: window--state-put-1
window--state-put-1 is a byte-compiled function defined in
window.el.gz.
Signature
(window--state-put-1 STATE &optional WINDOW IGNORE TOTALS PIXELWISE)
Documentation
Helper function for window-state-put.
Source Code
;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun window--state-put-1 (state &optional window ignore totals pixelwise)
"Helper function for `window-state-put'."
(let ((type (car state)))
(setq state (cdr state))
(cond
((eq type 'leaf)
;; For a leaf window just add unprocessed entries to
;; `window-state-put-list'.
(push (cons window state) window-state-put-list))
((memq type '(vc hc))
(let* ((horizontal (eq type 'hc))
(total (window-size window horizontal pixelwise))
(first t)
;; Make sure to make a new parent window for a horizontal
;; or vertical combination embedded in one of the same type
;; (see Bug#50867 and Bug#64405).
(window-combination-limit
(and (or (eq (cdr (assq 'combination-limit state)) t)
(and horizontal (window-combined-p window t))
(and (not horizontal) (window-combined-p window)))
t))
size new)
(dolist (item state)
;; Find the next child window. WINDOW always points to the
;; real window that we want to fill with what we find here.
(when (memq (car item) '(leaf vc hc))
(if (assq 'last item)
;; The last child window. Below `window--state-put-1'
;; will put into it whatever ITEM has in store.
(setq new nil)
;; Not the last child window, prepare for splitting
;; WINDOW. SIZE is the new (and final) size of the old
;; window.
(setq size
(if totals
;; Use total size.
(if pixelwise
(cdr (assq (if horizontal
'pixel-width
'pixel-height)
item))
(cdr (assq (if horizontal
'total-width
'total-height)
item)))
;; Use normalized size and round.
(round
(* total
(cdr (assq (if horizontal 'normal-width 'normal-height)
item))))))
;; Use safe sizes, we try to resize later.
(setq size (max size
(if horizontal
(* window-safe-min-width
(if pixelwise
(frame-char-width (window-frame window))
1))
(* window-safe-min-height
(if pixelwise
(frame-char-height (window-frame window))
1)))))
(if (window-sizable-p window (- size) horizontal 'safe pixelwise)
(progn
(setq new (split-window-no-error
window size horizontal pixelwise))
(setq window-combination-limit nil))
;; Give up if we can't resize window down to safe sizes.
(error "Cannot resize window %s" window))
(when first
(setq first nil)
;; When creating the first child window add for parent
;; unprocessed entries to `window-state-put-list'.
(setq window-state-put-list
(cons (cons (window-parent window) state)
window-state-put-list))))
;; Now process the current window (either the one we've just
;; split or the last child of its parent).
(window--state-put-1 item window ignore totals)
;; Continue with the last window split off.
(setq window new))))))))