Next: Splitting Windows, Previous: Window Sizes, Up: Windows
This section describes functions for resizing a window without changing the size of its frame. Because live windows do not overlap, these functions are meaningful only on frames that contain two or more windows: resizing a window also changes the size of a neighboring window. If there is just one window on a frame, its size cannot be changed except by resizing the frame (see Size and Position).
Except where noted, these functions also accept internal windows as arguments. Resizing an internal window causes its child windows to be resized to fit the same space.
This function returns delta if the size of window can be changed vertically by delta lines. If the optional argument horizontal is non-
nil, it instead returns delta if window can be resized horizontally by delta columns. It does not actually change the window size.If window is
nil, it defaults to the selected window.A positive value of delta means to check whether the window can be enlarged by that number of lines or columns; a negative value of delta means to check whether the window can be shrunk by that many lines or columns. If delta is non-zero, a return value of 0 means that the window cannot be resized.
Normally, the variables
window-min-heightandwindow-min-widthspecify the smallest allowable window size. See Deleting and Rearranging Windows. However, if the optional argument ignore is non-nil, this function ignoreswindow-min-heightandwindow-min-width, as well aswindow-size-fixed. Instead, it considers the minimum-height window to be one consisting 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.
This function resizes window by delta increments. If horizontal is
nil, it changes the height by delta lines; otherwise, it changes the width by delta columns. A positive delta means to enlarge the window, and a negative delta means to shrink it.If window is
nil, it defaults to the selected window. If the window cannot be resized as demanded, an error is signaled.The optional argument ignore has the same meaning as for the function
window-resizableabove.The choice of which window edges this function alters depends on the values of the option
window-combination-resizeand the combination limits of the involved windows; in some cases, it may alter both edges. See Recombining Windows. To resize by moving only the bottom or right edge of a window, use the functionadjust-window-trailing-edge, below.
This function moves window's bottom edge by delta lines. If optional argument horizontal is non-
nil, it instead moves the right edge by delta columns. If window isnil, it defaults to the selected window.A positive delta moves the edge downwards or to the right; a negative delta moves it upwards or to the left. If the edge cannot be moved as far as specified by delta, this function moves it as far as possible but does not signal a error.
This function tries to resize windows adjacent to the edge that is moved. If this is not possible for some reason (e.g., if that adjacent window is fixed-size), it may resize other windows.
The following commands resize windows in more specific ways. When called interactively, they act on the selected window.
This command adjusts the height of window to fit the text in it. It returns non-
nilif it was able to resize window, andnilotherwise. If window is omitted ornil, it defaults to the selected window. Otherwise, it should be a live window.The optional argument max-height, if non-
nil, specifies the maximum total height that this function can give window. The optional argument min-height, if non-nil, specifies the minimum total height that it can give, which overrides the variablewindow-min-height.If the optional argument override is non-
nil, this function ignores any size restrictions imposed bywindow-min-heightandwindow-min-width.If the option
fit-frame-to-bufferis non-nil, this command may resize the frame to fit its contents.
This command attempts to reduce window's height as much as possible while still showing its full buffer, but no less than
window-min-heightlines. The return value is non-nilif the window was resized, andnilotherwise. If window is omitted ornil, it defaults to the selected window. Otherwise, it should be a live window.This command does nothing if the window is already too short to display all of its buffer, or if any of the buffer is scrolled off-screen, or if the window is the only live window in its frame.
This function balances windows in a way that gives more space to full-width and/or full-height windows. If window-or-frame specifies a frame, it balances all windows on that frame. If window-or-frame specifies a window, it balances only that window and its siblings (see Windows and Frames).
This function attempts to give all windows on the selected frame approximately the same share of the screen area. Full-width or full-height windows are not given more space than other windows.