A window can get resized explicitly by using one of the functions from the preceding section or implicitly, for example, when resizing an adjacent window, when splitting or deleting a window (see Splitting Windows, see Deleting Windows) or when resizing the window's frame (see Frame Size).
It is possible to avoid implicit resizing of a specific window when there are one or more other resizable windows on the same frame. For this purpose, Emacs must be advised to preserve the size of that window. There are two basic ways to do that.
If this buffer-local variable is non-
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 the window's size, if there is no choice.
If the value is
height, then only the window's height is fixed; if the value is
width, then only the window's width is fixed. Any other non-
nilvalue fixes both the width and the height.
If this variable is
nil, this does not necessarily mean that any window showing the buffer can be resized in the desired direction. To determine that, use the function
window-resizable. See Resizing Windows.
window-size-fixed is overly aggressive because it inhibits
any attempt to explicitly resize or split an affected window as well.
This may even happen after the window has been resized implicitly, for
example, when deleting an adjacent window or resizing the window's
frame. The following function tries hard to never disallow resizing
such a window explicitly:
This function (un-)marks the height of window window as preserved for future resize operations. window must be a live window and defaults to the selected one. If the optional argument horizontal is non-
nil, it (un-)marks the width of window as preserved.
If the optional argument preserve is
t, this means to preserve the current height/width of window's body. The height/width of window will change only if Emacs has no better choice. Resizing a window whose height/width is preserved by this function never throws an error.
If preserve is
nil, this means to stop preserving the height/width of window, lifting any respective restraint induced by a previous call of this function for window. Calling
fit-window-to-bufferwith window as argument may also remove the respective restraint.
window-preserve-size is currently invoked by the following
nil, the size established by that function is preserved.
preserve-sizeentry, the size of the window produced by that function is preserved.
window-preserve-size installs a window parameter (see Window Parameters) called
window-preserved-size which is consulted by the
window resizing functions. This parameter will not prevent resizing the
window when the window shows another buffer than the one when
window-preserve-size was invoked or if its size has changed since
The following function can be used to check whether the height of a particular window is preserved:
This function returns the preserved height of window window in pixels. window must be a live window and defaults to the selected one. If the optional argument horizontal is non-
nil, it returns the preserved width of window. It returns
nilif the size of window is not preserved.