Next: Splitting Windows, Previous: Window Sizes, Up: Windows [Contents][Index]
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-height
and
window-min-width
specify the smallest allowable window size
(see Window Sizes). However, if the optional argument ignore
is non-nil
, this function ignores window-min-height
and
window-min-width
, as well as window-size-fixed
. Instead,
it considers the minimum-height window to be one consisting of a header,
a mode line and a bottom divider (if any), plus a text area one line
tall; and a minimum-width window as one consisting of fringes, margins,
a scroll bar and a right divider (if any), plus a text area two columns
wide.
If the optional argument pixelwise is non-nil
,
delta is interpreted as pixels.
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-resizable
above.
If the optional argument pixelwise is non-nil
,
delta will be interpreted as pixels.
The choice of which window edges this function alters depends on the
values of the option window-combination-resize
and 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 function
adjust-window-trailing-edge
.
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 is
nil
, it defaults to the selected window.
If the optional argument pixelwise is non-nil
,
delta is interpreted as pixels.
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.
If the value of this option is non-nil
, Emacs resizes windows in
units of pixels. This currently affects functions like
split-window
(see Splitting Windows), maximize-window
,
minimize-window
, fit-window-to-buffer
,
shrink-window-if-larger-than-buffer
(all listed below) and
fit-frame-to-buffer
(see Size and Position).
Note that when a frame’s pixel size is not a multiple of its character
size, at least one window may get resized pixelwise even if this
option is nil
. The default value is nil
.
The following commands resize windows in more specific ways. When called interactively, they act on the selected window.
This command adjusts the height or width of window to fit the text
in it. It returns non-nil
if it was able to resize window,
and nil
otherwise. If window is omitted or nil
, it
defaults to the selected window. Otherwise, it should be a live window.
If window is part of a vertical combination, this function adjusts
window’s height. The new height is calculated from the actual
height of the accessible portion of its buffer. 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 variable window-min-height
.
Both max-height and min-height are specified in lines and
include mode and header line and a bottom divider, if any.
If window is part of a horizontal combination and the value of the
option fit-window-to-buffer-horizontally
(see below) is
non-nil
, this function adjusts window’s height. The new
width of window is calculated from the maximum length of its
buffer’s lines that follow the current start position of window.
The optional argument max-width specifies a maximum width and
defaults to the width of window’s frame. The optional argument
min-width specifies a minimum width and defaults to
window-min-width
. Both max-width and min-width are
specified in columns and include fringes, margins and scrollbars, if
any.
If the option fit-frame-to-buffer
(see below) is non-nil
,
this function will try to resize the frame of window to fit its
contents by calling fit-frame-to-buffer
(see Size and Position).
If this is non-nil
, fit-window-to-buffer
can resize
windows horizontally. If this is nil
(the default)
fit-window-to-buffer
never resizes windows horizontally. If this
is only
, it can resize windows horizontally only. Any other
value means fit-window-to-buffer
can resize windows in both
dimensions.
If this option is non-nil
, fit-window-to-buffer
can fit a
frame to its buffer. A frame is fit if and only if its root window is a
live window and this option is non-nil
. If this is
horizontally
, frames are fit horizontally only. If this is
vertically
, frames are fit vertically only. Any other
non-nil
value means frames can be resized in both dimensions.
This command attempts to reduce window’s height as much as
possible while still showing its full buffer, but no less than
window-min-height
lines. The return value is non-nil
if
the window was resized, and nil
otherwise. If window is
omitted or nil
, 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 command calls fit-window-to-buffer
(see above) to do its
work.
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.
This function attempts to make window as large as possible, in
both dimensions, without resizing its frame or deleting other windows.
If window is omitted or nil
, it defaults to the selected
window.
This function attempts to make window as small as possible, in
both dimensions, without deleting it or resizing its frame. If
window is omitted or nil
, it defaults to the selected
window.
Next: Splitting Windows, Previous: Window Sizes, Up: Windows [Contents][Index]