+@cindex window body
+@cindex text area of a window
+@cindex body of a window
+ At the center of the window is the @dfn{text area}, or @dfn{body},
+where the buffer text is displayed. On each side of the text area is
+a series of vertical areas; from innermost to outermost, these are the
+left and right margins, denoted by LM and RM in the schematic
+(@pxref{Display Margins}); the left and right fringes, denoted by LF
+and RF (@pxref{Fringes}); and the left or right scroll bar, only one of
+which is present at any time, denoted by LS and RS (@pxref{Scroll
+Bars}). At the top of the window is an optional header line
+(@pxref{Header Lines}), and at the bottom of the window is the mode
+line (@pxref{Mode Line Format}).
+
+ Emacs provides several functions for finding the height and width of
+a window. Except where noted, Emacs reports window heights and widths
+as integer numbers of lines and columns, respectively. On a graphical
+display, each ``line'' and ``column'' actually corresponds to the
+height and width of a ``default'' character specified by the frame's
+default font. Thus, if a window is displaying text with a different
+font or size, the reported height and width for that window may differ
+from the actual number of text lines or columns displayed within it.
+
+@cindex window height
+@cindex height of a window
+@cindex total height of a window
+@cindex window width
+@cindex width of a window
+@cindex total width of a window
+ The @dfn{total height} of a window is the distance between the top
+and bottom of the window, including the header line (if one exists)
+and the mode line. The @dfn{total width} of a window is the distance
+between the left and right edges of the mode line. Note that the
+height of a frame is not the same as the height of its windows, since
+a frame may also contain an echo area, menu bar, and tool bar
+(@pxref{Size and Position}).
+
+@defun window-total-height &optional window
+This function returns the total height, in lines, of the window
+@var{window}. If @var{window} is omitted or @code{nil}, it defaults
+to the selected window. If @var{window} is an internal window, the
+return value is the total height occupied by its descendant windows.
+@end defun
+
+@defun window-total-width &optional window
+This function returns the total width, in columns, of the window
+@var{window}. If @var{window} is omitted or @code{nil}, it defaults
+to the selected window. If @var{window} is internal, the return value
+is the total width occupied by its descendant windows.
+@end defun
+
+@defun window-total-size &optional window horizontal
+This function returns either the total height or width of the window
+@var{window}. If @var{horizontal} is omitted or @code{nil}, this is
+equivalent to calling @code{window-total-height} for @var{window};
+otherwise it is equivalent to calling @code{window-total-width} for
+@var{window}.
+@end defun
+
+@cindex full-width window
+@cindex full-height window
+ The following functions can be used to determine whether a given
+window has any adjacent windows.
+
+@defun window-full-height-p &optional window
+This function returns non-@code{nil} if @var{window} has no other
+window above or below it in its frame, i.e. its total height equals
+the total height of the root window on that frame. If @var{window} is
+omitted or @code{nil}, it defaults to the selected window.
+@end defun
+
+@defun window-full-width-p &optional window
+This function returns non-@code{nil} if @var{window} has no other
+window to the left or right in its frame, i.e. its total width equals
+that of the root window on that frame. If @var{window} is omitted or
+@code{nil}, it defaults to the selected window.
+@end defun
+
+@cindex window body height
+@cindex body height of a window
+@cindex window body width
+@cindex body width of a window
+@cindex body size of a window
+@cindex window body size
+ The @dfn{body height} of a window is the height of its text area,
+which does not include the mode or header line. Similarly, the
+@dfn{body width} is the width of the text area, which does not include
+the scroll bar, fringes, or margins.
+
+@defun window-body-height &optional window
+This function returns the body height, in lines, of the window
+@var{window}. If @var{window} is omitted or @code{nil}, it defaults
+to the selected window; otherwise it must be a live window.
+
+If there is a partially-visible line at the bottom of the text area,
+that counts as a whole line; to exclude such a partially-visible line,
+use @code{window-text-height}, below.
+@end defun
+
+@defun window-body-width &optional window
+This function returns the body width, in columns, of the window
+@var{window}. If @var{window} is omitted or @code{nil}, it defaults
+to the selected window; otherwise it must be a live window.
+@end defun
+
+@defun window-body-size &optional window horizontal
+This function returns the body height or body width of @var{window}.
+If @var{horizontal} is omitted or @code{nil}, it is equivalent to
+calling @code{window-body-height} for @var{window}; otherwise it is
+equivalent to calling @code{window-body-width}.
+@end defun
+
+@defun window-text-height &optional window
+This function is like @code{window-body-height}, except that any
+partially-visible line at the bottom of the text area is not counted.
+@end defun
+
+ For compatibility with previous versions of Emacs,
+@code{window-height} is an alias for @code{window-total-height}, and
+@code{window-width} is an alias for @code{window-body-width}. These
+aliases are considered obsolete and will be removed in the future.
+
+@cindex fixed-size window
+ Commands that change the size of windows (@pxref{Resizing Windows}),
+or split them (@pxref{Splitting Windows}), obey the variables
+@code{window-min-height} and @code{window-min-width}, which specify
+the smallest allowable window height and width. @xref{Change
+Window,,Deleting and Rearranging Windows, emacs, The GNU Emacs
+Manual}. They also obey the variable @code{window-size-fixed}, with
+which a window can be @dfn{fixed} in size:
+
+@defvar window-size-fixed
+If this buffer-local variable is non-@code{nil}, the size of any
+window displaying the buffer cannot normally be changed. Deleting a
+window or changing the frame's size may still change its size, if
+there is no choice.
+
+If the value is @code{height}, then only the window's height is fixed;
+if the value is @code{width}, then only the window's width is fixed.
+Any other non-@code{nil} value fixes both the width and the height.
+@end defvar
+
+@defun window-size-fixed-p &optional window horizontal
+This function returns a non-@code{nil} value if @var{window}'s height
+is fixed. If @var{window} is omitted or @code{nil}, it defaults to
+the selected window. If the optional argument @var{horizontal} is
+non-@code{nil}, the return value is non-@code{nil} if @var{window}'s
+width is fixed.
+
+A @code{nil} return value does not necessarily mean that @var{window}
+can be resized in the desired direction. To determine that, use the
+function @code{window-resizable}. @xref{Resizing Windows}.
+@end defun
+
+ @xref{Coordinates and Windows}, for more functions that report the
+positions of various parts of a window relative to the frame, from
+which you can calculate its size. In particular, you can use the
+functions @code{window-pixel-edges} and
+@code{window-inside-pixel-edges} to find the size in pixels, for
+graphical displays.
+
+@node Resizing Windows
+@section Resizing Windows
+@cindex window resizing
+@cindex resize window
+@cindex changing window size
+@cindex window size, changing
+
+ 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 (@pxref{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.
+
+@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
+@var{window} can be resized horizontally by @var{delta} columns. It
+does not actually change the window size.
+
+If @var{window} is @code{nil}, it defaults to the selected window.
+
+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.
+@xref{Change Window,, Deleting and Rearranging Windows, emacs, The GNU
+Emacs Manual}. However, if the optional argument @var{ignore} is
+non-@code{nil}, this function ignores @code{window-min-height} and
+@code{window-min-width}, as well as @code{window-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.
+@end defun
+
+@defun window-resize window delta &optional horizontal ignore
+This function resizes @var{window} by @var{delta} increments. If
+@var{horizontal} is @code{nil}, it changes the height by @var{delta}
+lines; otherwise, it changes the width by @var{delta} columns. A
+positive @var{delta} means to enlarge the window, and a negative
+@var{delta} means to shrink it.
+
+If @var{window} is @code{nil}, it defaults to the selected window. If
+the window cannot be resized as demanded, an error is signaled.
+
+The optional argument @var{ignore} has the same meaning as for the
+function @code{window-resizable} above.
+
+The choice of which window edges this function alters depends on the
+values of the option @code{window-combination-resize} and the
+combination limits of the involved windows; in some cases, it may alter
+both edges. @xref{Splitting Windows}. To resize by moving only the
+bottom or right edge of a window, use the function
+@code{adjust-window-trailing-edge}, below.
+@end defun
+
+@c The commands enlarge-window, enlarge-window-horizontally,
+@c shrink-window, and shrink-window-horizontally are documented in the
+@c Emacs manual. They are not preferred for calling from Lisp.
+
+@defun adjust-window-trailing-edge window delta &optional horizontal
+This function moves @var{window}'s bottom edge by @var{delta} lines.
+If optional argument @var{horizontal} is non-@code{nil}, it instead
+moves the right edge by @var{delta} columns. If @var{window} is
+@code{nil}, it defaults to the selected window.
+
+A positive @var{delta} moves the edge downwards or to the right; a
+negative @var{delta} moves it upwards or to the left. If the edge
+cannot be moved as far as specified by @var{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.
+@end defun
+
+ The following commands resize windows in more specific ways. When
+called interactively, they act on the selected window.
+
+@deffn Command fit-window-to-buffer &optional window max-height min-height override
+This command adjusts the height of @var{window} to fit the text in it.
+It returns non-@code{nil} if it was able to resize @var{window}, and
+@code{nil} otherwise. If @var{window} is omitted or @code{nil}, it
+defaults to the selected window. Otherwise, it should be a live
+window.
+
+The optional argument @var{max-height}, if non-@code{nil}, specifies
+the maximum total height that this function can give @var{window}.
+The optional argument @var{min-height}, if non-@code{nil}, specifies
+the minimum total height that it can give, which overrides the
+variable @code{window-min-height}.
+
+If the optional argument @var{override} is non-@code{nil}, this
+function ignores any size restrictions imposed by
+@code{window-min-height} and @code{window-min-width}.
+@end deffn
+
+@deffn Command shrink-window-if-larger-than-buffer &optional window
+This command attempts to reduce @var{window}'s height as much as
+possible while still showing its full buffer, but no less than
+@code{window-min-height} lines. The return value is non-@code{nil} if
+the window was resized, and @code{nil} otherwise. If @var{window} is
+omitted or @code{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.
+@end deffn
+
+@cindex balancing window sizes
+@deffn Command balance-windows &optional window-or-frame
+This function balances windows in a way that gives more space to
+full-width and/or full-height windows. If @var{window-or-frame}
+specifies a frame, it balances all windows on that frame. If
+@var{window-or-frame} specifies a window, it balances only that window
+and its siblings (@pxref{Windows and Frames}).
+@end deffn
+
+@deffn Command balance-windows-area
+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.
+@end deffn
+
+@cindex maximizing windows
+@deffn Command maximize-window &optional window
+This function attempts to make @var{window} as large as possible, in
+both dimensions, without resizing its frame or deleting other windows.
+If @var{window} is omitted or @code{nil}, it defaults to the selected
+window.
+@end deffn
+
+@cindex minimizing windows
+@deffn Command minimize-window &optional window
+This function attempts to make @var{window} as small as possible, in
+both dimensions, without deleting it or resizing its frame. If
+@var{window} is omitted or @code{nil}, it defaults to the selected
+window.
+@end deffn
+
+
+@node Splitting Windows
+@section Splitting Windows
+@cindex splitting windows
+@cindex window splitting
+
+This section describes functions for creating a new window by
+@dfn{splitting} an existing one.
+
+@deffn Command split-window &optional window size side
+This function creates a new live window next to the window
+@var{window}. If @var{window} is omitted or @code{nil}, it defaults
+to the selected window. That window is ``split'', and reduced in
+size. The space is taken up by the new window, which is returned.
+
+The optional second argument @var{size} determines the sizes of
+@var{window} and/or the new window. If it is omitted or @code{nil},
+both windows are given equal sizes; if there is an odd line, it is
+allocated to the new window. If @var{size} is a positive number,
+@var{window} is given @var{size} lines (or columns, depending on the
+value of @var{side}). If @var{size} is a negative number, the new
+window is given @minus{}@var{size} lines (or columns).
+
+If @var{size} is @code{nil}, this function obeys the variables
+@code{window-min-height} and @code{window-min-width}. @xref{Change
+Window,,Deleting and Rearranging Windows, emacs, The GNU Emacs
+Manual}. Thus, it signals an error if splitting would result in
+making a window smaller than those variables specify. However, a
+non-@code{nil} value for @var{size} causes those variables to be
+ignored; in that case, the smallest allowable window is considered to
+be one that has space for a text area one line tall and/or two columns
+wide.
+
+The optional third argument @var{side} determines the position of the
+new window relative to @var{window}. If it is @code{nil} or
+@code{below}, the new window is placed below @var{window}. If it is
+@code{above}, the new window is placed above @var{window}. In both
+these cases, @var{size} specifies a total window height, in lines.
+
+If @var{side} is @code{t} or @code{right}, the new window is placed on
+the right of @var{window}. If @var{side} is @code{left}, the new
+window is placed on the left of @var{window}. In both these cases,
+@var{size} specifies a total window width, in columns.
+
+If @var{window} is a live window, the new window inherits various
+properties from it, including margins and scroll bars. If
+@var{window} is an internal window, the new window inherits the
+properties of the window selected within @var{window}'s frame.
+
+The behavior of this function may be altered by the window parameters
+of @var{window}, so long as the variable
+@code{ignore-window-parameters} is @code{nil}. If the value of
+the @code{split-window} window parameter is @code{t}, this function
+ignores all other window parameters. Otherwise, if the value of the
+@code{split-window} window parameter is a function, that function is
+called with the arguments @var{window}, @var{size}, and @var{side}, in
+lieu of the usual action of @code{split-window}. Otherwise, this
+function obeys the @code{window-atom} or @code{window-side} window
+parameter, if any. @xref{Window Parameters}.
+@end deffn
+
+ As an example, here is a sequence of @code{split-window} calls that
+yields the window configuration discussed in @ref{Windows and Frames}.
+This example demonstrates splitting a live window as well as splitting
+an internal window. We begin with a frame containing a single window
+(a live root window), which we denote by @var{W4}. Calling
+@code{(split-window W4)} yields this window configuration: