arguments. Resizing an internal window causes its child windows to be
resized to fit the same space.
-@defun window-resizable window delta &optional horizontal ignore side noup nodown
+@defun window-resizable window delta &optional horizontal ignore
This function returns @var{delta} if the size of @var{window} can be
changed vertically by @var{delta} lines. If the optional argument
@var{horizontal} is non-@code{nil}, it instead returns @var{delta} if
If @var{window} is @code{nil}, it defaults to the selected window.
-A positive value of @var{delta} enlarges the window by that number of
-lines or columns; a negative value of @var{delta} shrinks it. If
-@var{delta} is non-zero, a return value of 0 means that the window
-cannot be resized.
+A positive value of @var{delta} means to check whether the window can be
+enlarged by that number of lines or columns; a negative value of
+@var{delta} means to check whether the window can be shrunk by that many
+lines or columns. If @var{delta} is non-zero, a return value of 0 means
+that the window cannot be resized.
Normally, the variables @code{window-min-height} and
@code{window-min-width} specify the smallest allowable window size.
of a header (if any), a mode line, plus a text area one line tall; and
a minimum-width window as one consisting of fringes, margins, and
scroll bar (if any), plus a text area two columns wide.
-
-If the optional argument @var{noup} is non-@code{nil}, this function
-considers a resize operation that does not alter the window parent of
-@var{window}, only its siblings. If the optional argument
-@var{nodown} is non-@code{nil}, it does not attempt to check whether
-@var{window} itself and its child windows can be resized.
@end defun
@defun window-resize window delta &optional horizontal ignore
non-nil if WINDOW's width is fixed.
If this function returns nil, this does not necessarily mean that
-WINDOW can be resized in the desired direction. The functions
-`window-resizable' and `window-resizable-p' will tell that."
+WINDOW can be resized in the desired direction. The function
+`window-resizable' can tell that."
(window-size-fixed-1
(window-normalize-window window) horizontal))
(window-max-delta-1 window 0 horizontal ignore trail noup)))
;; Make NOUP also inhibit the min-size check.
-(defun window-resizable (window delta &optional horizontal ignore trail noup nodown)
+(defun window--resizable (window delta &optional horizontal ignore trail noup nodown)
"Return DELTA if WINDOW can be resized vertically by DELTA lines.
Optional argument HORIZONTAL non-nil means return DELTA if WINDOW
can be resized horizontally by DELTA columns. A return value of
zero means that WINDOW is not resizable.
DELTA positive means WINDOW shall be enlarged by DELTA lines or
-columns. If WINDOW cannot be enlarged by DELTA lines or columns
+columns. If WINDOW cannot be enlarged by DELTA lines or columns,
return the maximum value in the range 0..DELTA by which WINDOW
can be enlarged.
shrunk.
Optional argument NOUP non-nil means don't go up in the window
-tree but try to distribute the space among the other windows
-within WINDOW's combination.
+tree but check only whether space can be obtained from (or given
+to) WINDOW's siblings.
-Optional argument NODOWN non-nil means don't check whether WINDOW
-and its child windows can be resized."
+Optional argument NODOWN non-nil means don't go down in the
+window tree. This means do not check whether resizing would
+violate size restrictions of WINDOW or its child windows."
(setq window (window-normalize-window window))
(cond
((< delta 0)
delta))
(t 0)))
-(defun window-resizable-p (window delta &optional horizontal ignore trail noup nodown)
+(defun window--resizable-p (window delta &optional horizontal ignore trail noup nodown)
"Return t if WINDOW can be resized vertically by DELTA lines.
For the meaning of the arguments of this function see the
-doc-string of `window-resizable'."
+doc-string of `window--resizable'."
(setq window (window-normalize-window window))
(if (> delta 0)
- (>= (window-resizable window delta horizontal ignore trail noup nodown)
+ (>= (window--resizable window delta horizontal ignore trail noup nodown)
delta)
- (<= (window-resizable window delta horizontal ignore trail noup nodown)
+ (<= (window--resizable window delta horizontal ignore trail noup nodown)
delta)))
+(defun window-resizable (window delta &optional horizontal ignore)
+ "Return DELTA if WINDOW can be resized vertically by DELTA lines.
+Optional argument HORIZONTAL non-nil means return DELTA if WINDOW
+can be resized horizontally by DELTA columns. A return value of
+zero means that WINDOW is not resizable.
+
+DELTA positive means WINDOW shall be enlarged by DELTA lines or
+columns. If WINDOW cannot be enlarged by DELTA lines or columns
+return the maximum value in the range 0..DELTA by which WINDOW
+can be enlarged.
+
+DELTA negative means WINDOW shall be shrunk by -DELTA lines or
+columns. If WINDOW cannot be shrunk by -DELTA lines or columns,
+return the minimum value in the range DELTA..0 that can be used
+for shrinking WINDOW.
+
+Optional argument IGNORE non-nil means ignore any restrictions
+imposed by fixed size windows, `window-min-height' or
+`window-min-width' settings. IGNORE a window means ignore
+restrictions for that window only. IGNORE equal `safe' means
+live windows may get as small as `window-safe-min-height' lines
+and `window-safe-min-width' columns."
+ (setq window (window-normalize-window window))
+ (window--resizable window delta horizontal ignore))
+
(defun window-total-size (&optional window horizontal)
"Return the total height or width of window WINDOW.
If WINDOW is omitted or nil, it defaults to the selected window.
(error "Cannot resize the root window of a frame"))
((window-minibuffer-p window)
(window--resize-mini-window window delta))
- ((window-resizable-p window delta horizontal ignore)
+ ((window--resizable-p window delta horizontal ignore)
(window--resize-reset frame horizontal)
(window--resize-this-window window delta horizontal ignore t)
(if (and (not (window-splits window))
;; Set this-delta to what we can get from WINDOW's siblings.
(if (= (- delta) (window-total-size window horizontal))
;; A deletion, presumably. We must handle this case
- ;; specially since `window-resizable' can't be used.
+ ;; specially since `window--resizable' can't be used.
(if this-delta
;; There's at least one resizable sibling we can
;; give WINDOW's size to.
(setq this-delta 0))
;; Any other form of resizing.
(setq this-delta
- (window-resizable window delta horizontal ignore trail t)))
+ (window--resizable window delta horizontal ignore trail t)))
;; Set other-delta to what we still have to get from
;; ancestor windows of parent.
preferably only resize windows adjacent to EDGE.
This function recursively resizes WINDOW's child windows to fit the
-new size. Make sure that WINDOW is `window-resizable' before
+new size. Make sure that WINDOW is `window--resizable' before
calling this function. Note that this function does not resize
siblings of WINDOW or WINDOW's parent window. You have to
eventually call `window-resize-apply' in order to make resizing
;; Start resizing.
(window--resize-reset frame horizontal)
;; Try to enlarge LEFT first.
- (setq this-delta (window-resizable left delta horizontal))
+ (setq this-delta (window--resizable left delta horizontal))
(unless (zerop this-delta)
(window--resize-this-window
left this-delta horizontal nil t 'before
;; Start resizing.
(window--resize-reset frame horizontal)
;; Try to enlarge RIGHT.
- (setq this-delta (window-resizable right (- delta) horizontal))
+ (setq this-delta (window--resizable right (- delta) horizontal))
(unless (zerop this-delta)
(window--resize-this-window
right this-delta horizontal nil t 'after
((zerop delta))
((window-size-fixed-p nil horizontal)
(error "Selected window has fixed size"))
- ((window-resizable-p nil delta horizontal)
+ ((window--resizable-p nil delta horizontal)
(window-resize nil delta horizontal))
(t
(window-resize
((zerop delta))
((window-size-fixed-p nil horizontal)
(error "Selected window has fixed size"))
- ((window-resizable-p nil (- delta) horizontal)
+ ((window--resizable-p nil (- delta) horizontal)
(window-resize nil (- delta) horizontal))
(t
(window-resize
(set-window-new-normal
sibling (+ (window-normal-size sibling horizontal)
(window-normal-size window horizontal))))
- ((window-resizable-p window (- size) horizontal nil nil nil t)
+ ((window--resizable-p window (- size) horizontal nil nil nil t)
;; Can do without resizing fixed-size windows.
(window--resize-siblings window (- size) horizontal))
(t
(let ((delta (- (cdr (assq 'total-height item))
(window-total-height window)))
window-size-fixed)
- (when (window-resizable-p window delta)
+ (when (window--resizable-p window delta)
(window-resize window delta)))
;; Else check whether the window is not high enough.
(let* ((min-size (window-min-size window nil ignore))
(delta (- min-size (window-total-size window))))
(when (and (> delta 0)
- (window-resizable-p window delta nil ignore))
+ (window--resizable-p window delta nil ignore))
(window-resize window delta nil ignore))))
;; Adjust horizontally.
(if (memq window-size-fixed '(t width))
(let ((delta (- (cdr (assq 'total-width item))
(window-total-width window)))
window-size-fixed)
- (when (window-resizable-p window delta)
+ (when (window--resizable-p window delta)
(window-resize window delta)))
;; Else check whether the window is not wide enough.
(let* ((min-size (window-min-size window t ignore))
(delta (- min-size (window-total-size window t))))
(when (and (> delta 0)
- (window-resizable-p window delta t ignore))
+ (window--resizable-p window delta t ignore))
(window-resize window delta t ignore))))
;; Set dedicated status.
(set-window-dedicated-p window (cdr (assq 'dedicated state)))