diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/resizing-windows.html | |
new repository
Diffstat (limited to 'devdocs/elisp/resizing-windows.html')
| -rw-r--r-- | devdocs/elisp/resizing-windows.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/devdocs/elisp/resizing-windows.html b/devdocs/elisp/resizing-windows.html new file mode 100644 index 00000000..b2960543 --- /dev/null +++ b/devdocs/elisp/resizing-windows.html @@ -0,0 +1,52 @@ + <h3 class="section">Resizing Windows</h3> <p>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 at least one other window. If there is just one window on a frame, its size cannot be changed except by resizing the frame (see <a href="frame-size">Frame Size</a>). </p> <p>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. </p> <dl> <dt id="window-resizable">Function: <strong>window-resizable</strong> <em>window delta &optional horizontal ignore pixelwise</em> +</dt> <dd> +<p>This function returns <var>delta</var> if the size of <var>window</var> can be changed vertically by <var>delta</var> lines. If the optional argument <var>horizontal</var> is non-<code>nil</code>, it instead returns <var>delta</var> if <var>window</var> can be resized horizontally by <var>delta</var> columns. It does not actually change the window size. </p> <p>If <var>window</var> is <code>nil</code>, it defaults to the selected window. </p> <p>A positive value of <var>delta</var> means to check whether the window can be enlarged by that number of lines or columns; a negative value of <var>delta</var> means to check whether the window can be shrunk by that many lines or columns. If <var>delta</var> is non-zero, a return value of 0 means that the window cannot be resized. </p> <p>Normally, the variables <code>window-min-height</code> and <code>window-min-width</code> specify the smallest allowable window size (see <a href="window-sizes">Window Sizes</a>). However, if the optional argument <var>ignore</var> is non-<code>nil</code>, this function ignores <code>window-min-height</code> and <code>window-min-width</code>, as well as <code>window-size-fixed</code>. Instead, it considers the minimum height of a window as the sum of its top and bottom decorations plus the text of one line; and its minimum width as the sum of its left and right decorations plus text that takes two columns. </p> <p>If the optional argument <var>pixelwise</var> is non-<code>nil</code>, <var>delta</var> is interpreted as pixels. </p> +</dd> +</dl> <dl> <dt id="window-resize">Function: <strong>window-resize</strong> <em>window delta &optional horizontal ignore pixelwise</em> +</dt> <dd> +<p>This function resizes <var>window</var> by <var>delta</var> increments. If <var>horizontal</var> is <code>nil</code>, it changes the height by <var>delta</var> lines; otherwise, it changes the width by <var>delta</var> columns. A positive <var>delta</var> means to enlarge the window, and a negative <var>delta</var> means to shrink it. </p> <p>If <var>window</var> is <code>nil</code>, it defaults to the selected window. If the window cannot be resized as demanded, an error is signaled. </p> <p>The optional argument <var>ignore</var> has the same meaning as for the function <code>window-resizable</code> above. </p> <p>If the optional argument <var>pixelwise</var> is non-<code>nil</code>, <var>delta</var> will be interpreted as pixels. </p> <p>The choice of which window edges this function alters depends on the values of the option <code>window-combination-resize</code> and the combination limits of the involved windows; in some cases, it may alter both edges. See <a href="recombining-windows">Recombining Windows</a>. To resize by moving only the bottom or right edge of a window, use the function <code>adjust-window-trailing-edge</code>. </p> +</dd> +</dl> <dl> <dt id="adjust-window-trailing-edge">Function: <strong>adjust-window-trailing-edge</strong> <em>window delta &optional horizontal pixelwise</em> +</dt> <dd> +<p>This function moves <var>window</var>’s bottom edge by <var>delta</var> lines. If optional argument <var>horizontal</var> is non-<code>nil</code>, it instead moves the right edge by <var>delta</var> columns. If <var>window</var> is <code>nil</code>, it defaults to the selected window. </p> <p>If the optional argument <var>pixelwise</var> is non-<code>nil</code>, <var>delta</var> is interpreted as pixels. </p> <p>A positive <var>delta</var> moves the edge downwards or to the right; a negative <var>delta</var> moves it upwards or to the left. If the edge cannot be moved as far as specified by <var>delta</var>, this function moves it as far as possible but does not signal an error. </p> <p>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. </p> +</dd> +</dl> <dl> <dt id="window-resize-pixelwise">User Option: <strong>window-resize-pixelwise</strong> +</dt> <dd> +<p>If the value of this option is non-<code>nil</code>, Emacs resizes windows in units of pixels. This currently affects functions like <code>split-window</code> (see <a href="splitting-windows">Splitting Windows</a>), <code>maximize-window</code>, <code>minimize-window</code>, <code>fit-window-to-buffer</code>, <code>fit-frame-to-buffer</code> and <code>shrink-window-if-larger-than-buffer</code> (all listed below). </p> <p>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 <code>nil</code>. The default value is <code>nil</code>. </p> +</dd> +</dl> <p>The following commands resize windows in more specific ways. When called interactively, they act on the selected window. </p> <dl> <dt id="fit-window-to-buffer">Command: <strong>fit-window-to-buffer</strong> <em>&optional window max-height min-height max-width min-width preserve-size</em> +</dt> <dd> +<p>This command adjusts the height or width of <var>window</var> to fit the text in it. It returns non-<code>nil</code> if it was able to resize <var>window</var>, and <code>nil</code> otherwise. If <var>window</var> is omitted or <code>nil</code>, it defaults to the selected window. Otherwise, it should be a live window. </p> <p>If <var>window</var> is part of a vertical combination, this function adjusts <var>window</var>’s height. The new height is calculated from the actual height of the accessible portion of its buffer. The optional argument <var>max-height</var>, if non-<code>nil</code>, specifies the maximum total height that this function can give <var>window</var>. The optional argument <var>min-height</var>, if non-<code>nil</code>, specifies the minimum total height that it can give, which overrides the variable <code>window-min-height</code>. Both <var>max-height</var> and <var>min-height</var> are specified in lines and include any top or bottom decorations of <var>window</var>. </p> <p>If <var>window</var> is part of a horizontal combination and the value of the option <code>fit-window-to-buffer-horizontally</code> (see below) is non-<code>nil</code>, this function adjusts <var>window</var>’s width. The new width of <var>window</var> is calculated from the maximum length of its buffer’s lines that follow the current start position of <var>window</var>. The optional argument <var>max-width</var> specifies a maximum width and defaults to the width of <var>window</var>’s frame. The optional argument <var>min-width</var> specifies a minimum width and defaults to <code>window-min-width</code>. Both <var>max-width</var> and <var>min-width</var> are specified in columns and include any left or right decorations of <var>window</var>. </p> <p>The optional argument <var>preserve-size</var>, if non-<code>nil</code>, will install a parameter to preserve the size of <var>window</var> during future resize operations (see <a href="preserving-window-sizes">Preserving Window Sizes</a>). </p> <p>If the option <code>fit-frame-to-buffer</code> (see below) is non-<code>nil</code>, this function will try to resize the frame of <var>window</var> to fit its contents by calling <code>fit-frame-to-buffer</code> (see below). </p> +</dd> +</dl> <dl> <dt id="fit-window-to-buffer-horizontally">User Option: <strong>fit-window-to-buffer-horizontally</strong> +</dt> <dd><p>If this is non-<code>nil</code>, <code>fit-window-to-buffer</code> can resize windows horizontally. If this is <code>nil</code> (the default) <code>fit-window-to-buffer</code> never resizes windows horizontally. If this is <code>only</code>, it can resize windows horizontally only. Any other value means <code>fit-window-to-buffer</code> can resize windows in both dimensions. </p></dd> +</dl> <dl> <dt id="fit-frame-to-buffer">User Option: <strong>fit-frame-to-buffer</strong> +</dt> <dd><p>If this option is non-<code>nil</code>, <code>fit-window-to-buffer</code> 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-<code>nil</code>. If this is <code>horizontally</code>, frames are fit horizontally only. If this is <code>vertically</code>, frames are fit vertically only. Any other non-<code>nil</code> value means frames can be resized in both dimensions. </p></dd> +</dl> <p>If you have a frame that displays only one window, you can fit that frame to its buffer using the command <code>fit-frame-to-buffer</code>. </p> <dl> <dt id="fit-frame-to-buffer">Command: <strong>fit-frame-to-buffer</strong> <em>&optional frame max-height min-height max-width min-width only</em> +</dt> <dd> +<p>This command adjusts the size of <var>frame</var> to display the contents of its buffer exactly. <var>frame</var> can be any live frame and defaults to the selected one. Fitting is done only if <var>frame</var>’s root window is live. The arguments <var>max-height</var>, <var>min-height</var>, <var>max-width</var> and <var>min-width</var> specify bounds on the new total size of <var>frame</var>’s root window. <var>min-height</var> and <var>min-width</var> default to the values of <code>window-min-height</code> and <code>window-min-width</code> respectively. </p> <p>If the optional argument <var>only</var> is <code>vertically</code>, this function may resize the frame vertically only. If <var>only</var> is <code>horizontally</code>, it may resize the frame horizontally only. </p> +</dd> +</dl> <p>The behavior of <code>fit-frame-to-buffer</code> can be controlled with the help of the two options listed next. </p> <dl> <dt id="fit-frame-to-buffer-margins">User Option: <strong>fit-frame-to-buffer-margins</strong> +</dt> <dd> +<p>This option can be used to specify margins around frames to be fit by <code>fit-frame-to-buffer</code>. Such margins can be useful to avoid, for example, that the resized frame overlaps the taskbar or parts of its parent frame. </p> <p>It specifies the numbers of pixels to be left free on the left, above, the right, and below a frame that shall be fit. The default specifies <code>nil</code> for each which means to use no margins. The value specified here can be overridden for a specific frame by that frame’s <code>fit-frame-to-buffer-margins</code> parameter, if present. </p> +</dd> +</dl> <dl> <dt id="fit-frame-to-buffer-sizes">User Option: <strong>fit-frame-to-buffer-sizes</strong> +</dt> <dd><p>This option specifies size boundaries for <code>fit-frame-to-buffer</code>. It specifies the total maximum and minimum lines and maximum and minimum columns of the root window of any frame that shall be fit to its buffer. If any of these values is non-<code>nil</code>, it overrides the corresponding argument of <code>fit-frame-to-buffer</code>. </p></dd> +</dl> <dl> <dt id="shrink-window-if-larger-than-buffer">Command: <strong>shrink-window-if-larger-than-buffer</strong> <em>&optional window</em> +</dt> <dd> +<p>This command attempts to reduce <var>window</var>’s height as much as possible while still showing its full buffer, but no less than <code>window-min-height</code> lines. The return value is non-<code>nil</code> if the window was resized, and <code>nil</code> otherwise. If <var>window</var> is omitted or <code>nil</code>, it defaults to the selected window. Otherwise, it should be a live window. </p> <p>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. </p> <p>This command calls <code>fit-window-to-buffer</code> (see above) to do its work. </p> +</dd> +</dl> <dl> <dt id="balance-windows">Command: <strong>balance-windows</strong> <em>&optional window-or-frame</em> +</dt> <dd><p>This function balances windows in a way that gives more space to full-width and/or full-height windows. If <var>window-or-frame</var> specifies a frame, it balances all windows on that frame. If <var>window-or-frame</var> specifies a window, it balances only that window and its siblings (see <a href="windows-and-frames">Windows and Frames</a>). </p></dd> +</dl> <dl> <dt id="balance-windows-area">Command: <strong>balance-windows-area</strong> +</dt> <dd><p>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. </p></dd> +</dl> <dl> <dt id="maximize-window">Command: <strong>maximize-window</strong> <em>&optional window</em> +</dt> <dd><p>This function attempts to make <var>window</var> as large as possible, in both dimensions, without resizing its frame or deleting other windows. If <var>window</var> is omitted or <code>nil</code>, it defaults to the selected window. </p></dd> +</dl> <dl> <dt id="minimize-window">Command: <strong>minimize-window</strong> <em>&optional window</em> +</dt> <dd><p>This function attempts to make <var>window</var> as small as possible, in both dimensions, without deleting it or resizing its frame. If <var>window</var> is omitted or <code>nil</code>, it defaults to the selected window. </p></dd> +</dl><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Resizing-Windows.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Resizing-Windows.html</a> + </p> +</div> |
