Function: window--try-to-split-window

window--try-to-split-window is a byte-compiled function defined in window.el.gz.

Signature

(window--try-to-split-window WINDOW &optional ALIST)

Documentation

Try to split WINDOW.

Return value returned by split-window-preferred-function if it represents a live window, nil otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun window--try-to-split-window (window &optional alist)
  "Try to split WINDOW.
Return value returned by `split-window-preferred-function' if it
represents a live window, nil otherwise."
      (and (window-live-p window)
	   (not (frame-parameter (window-frame window) 'unsplittable))
	   (let* ((window-combination-limit
		   ;; When `window-combination-limit' equals
		   ;; `display-buffer' or equals `resize-window' and a
		   ;; `window-height' or `window-width' alist entry are
		   ;; present, bind it to t so resizing steals space
		   ;; preferably from the window that was split.
		   (if (or (eq window-combination-limit 'display-buffer)
			   (and (eq window-combination-limit 'window-size)
				(or (cdr (assq 'window-height alist))
				    (cdr (assq 'window-width alist)))))
		       t
		     window-combination-limit))
		  (new-window
		   ;; Since `split-window-preferred-function' might
		   ;; throw an error use `condition-case'.
		   (condition-case nil
		       (funcall split-window-preferred-function window)
		     (error nil))))
	     (and (window-live-p new-window) new-window))))