Function: window--min-size-1

window--min-size-1 is a byte-compiled function defined in window.el.gz.

Signature

(window--min-size-1 WINDOW HORIZONTAL IGNORE PIXELWISE)

Documentation

Internal function of window-min-size.

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun window--min-size-1 (window horizontal ignore pixelwise)
  "Internal function of `window-min-size'."
  (let ((sub (window-child window)))
    (if sub
	(let ((value 0))
	  ;; WINDOW is an internal window.
	  (if (window-combined-p sub horizontal)
	      ;; The minimum size of an iso-combination is the sum of
	      ;; the minimum sizes of its child windows.
	      (while sub
		(setq value (+ value
			       (window--min-size-1
				sub horizontal ignore pixelwise)))
		(setq sub (window-right sub)))
	    ;; The minimum size of an ortho-combination is the maximum
	    ;; of the minimum sizes of its child windows.
	    (while sub
	      (setq value (max value
			       (window--min-size-1
				sub horizontal ignore pixelwise)))
	      (setq sub (window-right sub))))
	  value)
      (with-current-buffer (window-buffer window)
	(cond
	 ((window-size-fixed-p window horizontal ignore)
	  ;; The minimum size of a fixed size window is its size.
	  (window-size window horizontal pixelwise))
	 ((eq ignore 'safe)
	  ;; If IGNORE equals `safe' return the safe value.
	  (window-safe-min-size window horizontal pixelwise))
	 (horizontal
	  ;; For the minimum width of a window take fringes and
	  ;; scroll-bars into account.  This is questionable and should
	  ;; be removed as soon as we are able to split (and resize)
	  ;; windows such that the new (or resized) windows can get a
	  ;; size less than the user-specified `window-min-height' and
	  ;; `window-min-width'.
	  (let* ((char-size (frame-char-size window t))
		 (fringes (window-fringes window))
		 (margins (window-margins window))
                 ;; Let the 'min-margins' parameter override the actual
                 ;; widths of the margins.  We allow any number to
                 ;; replace the values specified by `window-margins'.
                 ;; See bug#24193 for the rationale of this parameter.
                 (min-margins (window-parameter window 'min-margins))
                 (left-min-margin (and min-margins
                                       (numberp (car min-margins))
                                       (car min-margins)))
                 (right-min-margin (and min-margins
                                        (numberp (cdr min-margins))
                                        (cdr min-margins)))
		 (pixel-width
		  (+ (window-safe-min-size window t t)
		     (* (or left-min-margin (car margins) 0) char-size)
		     (* (or right-min-margin(cdr margins) 0) char-size)
		     (car fringes) (cadr fringes)
		     (window-scroll-bar-width window)
		     (window-right-divider-width window))))
	    (if pixelwise
		(max
		 (if window-resize-pixelwise
		     pixel-width
		   ;; Round up to next integral of columns.
		   (* (ceiling pixel-width char-size) char-size))
		 (if (window--min-size-ignore-p window ignore)
		     0
		   (window-min-pixel-width window)))
	      (max
	       (ceiling pixel-width char-size)
	       (if (window--min-size-ignore-p window ignore)
		   0
		 window-min-width)))))
	 ((let ((char-size (frame-char-size window))
		(pixel-height
		 (+ (window-safe-min-size window nil t)
		    (window-tab-line-height window)
		    (window-header-line-height window)
		    (window-scroll-bar-height window)
		    (window-mode-line-height window)
		    (window-bottom-divider-width window))))
	    (if pixelwise
		(max
		 (if window-resize-pixelwise
		     pixel-height
		   ;; Round up to next integral of lines.
		   (* (ceiling pixel-height char-size) char-size))
		 (if (window--min-size-ignore-p window ignore)
		     0
		   (window-min-pixel-height window)))
	      (max (ceiling pixel-height char-size)
		   (if (window--min-size-ignore-p window ignore)
		       0
		     window-min-height))))))))))