GNU Emacs Lisp Reference Manual
An Emacs window is rectangular, and its size information consists of
the height (the number of lines) and the width (the number of character
positions in each line). The mode line is included in the height. But
the width does not count the scroll bar or the column of |
characters that separates side-by-side windows.
The following three functions return size information about a window:
frame-height on that frame (since the last line
is always reserved for the minibuffer).
If window is nil, the function uses the selected window.
(window-height)
=> 23
(split-window-vertically)
=> #<window 4 on windows.texi>
(window-height)
=> 11
frame-width on that frame. The width does not include the
window's scroll bar or the column of | characters that separates
side-by-side windows.
If window is nil, the function uses the selected window.
(window-width)
=> 80
nil, the selected window is used.
The order of the list is (left top right bottom), all elements relative to 0, 0 at the top left corner of
the frame. The element right of the value is one more than the
rightmost column used by window, and bottom is one more than
the bottommost row used by window and its mode-line.
When you have side-by-side windows, the right edge value for a window
with a neighbor on the right includes the width of the separator between
the window and that neighbor. This separator may be a column of
| characters or it may be a scroll bar. Since the width of the
window does not include this separator, the width does not equal the
difference between the right and left edges in this case.
Here is the result obtained on a typical 24-line terminal with just one window:
(window-edges (selected-window))
=> (0 0 80 23)
The bottom edge is at line 23 because the last line is the echo area.
If window is at the upper left corner of its frame, right
and bottom are the same as the values returned by
(window-width) and (window-height) respectively, and
top and bottom are zero. For example, the edges of the
following window are 0 0 5 8. Assuming that the frame has
more than 8 columns, the last column of the window (column 7) holds a
border rather than text. The last row (row 4) holds the mode line,
shown here with xxxxxxxxx.
0
_______
0 | |
| |
| |
| |
xxxxxxxxx 4
7
When there are side-by-side windows, any window not at the right edge of its frame has a separator in its last column or columns. The separator counts as one or two columns in the width of the window. A window never includes a separator on its left, since that belongs to the window to the left.
In the following example, let's suppose that the frame is 7
columns wide. Then the edges of the left window are 0 0 4 3
and the edges of the right window are 4 0 7 3.
___ ___
| | |
| | |
xxxxxxxxx
0 34 7