summaryrefslogtreecommitdiff
path: root/devdocs/elisp/dedicated-windows.html
blob: 853f70e54e6f433a72f70093a46300e52570ebf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
 <h3 class="section">Dedicated Windows</h3>  <p>Functions for displaying a buffer can be told to not use specific windows by marking these windows as <em>dedicated</em> to their buffers. <code>display-buffer</code> (see <a href="choosing-window">Choosing Window</a>) never uses a dedicated window for displaying another buffer in it. <code>get-lru-window</code> and <code>get-largest-window</code> (see <a href="cyclic-window-ordering">Cyclic Window Ordering</a>) do not consider dedicated windows as candidates when their <var>dedicated</var> argument is non-<code>nil</code>. The behavior of <code>set-window-buffer</code> (see <a href="buffers-and-windows">Buffers and Windows</a>) with respect to dedicated windows is slightly different, see below. </p> <p>Functions supposed to remove a buffer from a window or a window from a frame can behave specially when a window they operate on is dedicated. We will distinguish four basic cases, namely where (1) the window is not the only window on its frame, (2) the window is the only window on its frame but there are other frames on the same terminal left, (3) the window is the only window on the only frame on the same terminal, and (4) the dedication’s value is <code>side</code> (see <a href="displaying-buffers-in-side-windows">Displaying Buffers in Side Windows</a>). </p> <p>In particular, <code>delete-windows-on</code> (see <a href="deleting-windows">Deleting Windows</a>) handles case (2) by deleting the associated frame and cases (3) and (4) by showing another buffer in that frame’s only window. The function <code>replace-buffer-in-windows</code> (see <a href="buffers-and-windows">Buffers and Windows</a>) which is called when a buffer gets killed, deletes the window in case (1) and behaves like <code>delete-windows-on</code> otherwise. </p> <p>When <code>bury-buffer</code> (see <a href="buffer-list">Buffer List</a>) operates on the selected window (which shows the buffer that shall be buried), it handles case (2) by calling <code>frame-auto-hide-function</code> (see <a href="quitting-windows">Quitting Windows</a>) to deal with the selected frame. The other two cases are handled as with <code>replace-buffer-in-windows</code>. </p> <dl> <dt id="window-dedicated-p">Function: <strong>window-dedicated-p</strong> <em>&amp;optional window</em>
</dt> <dd><p>This function returns non-<code>nil</code> if <var>window</var> is dedicated to its buffer and <code>nil</code> otherwise. More precisely, the return value is the value assigned by the last call of <code>set-window-dedicated-p</code> for <var>window</var>, or <code>nil</code> if that function was never called with <var>window</var> as its argument. The default for <var>window</var> is the selected window. </p></dd>
</dl> <dl> <dt id="set-window-dedicated-p">Function: <strong>set-window-dedicated-p</strong> <em>window flag</em>
</dt> <dd>
<p>This function marks <var>window</var> as dedicated to its buffer if <var>flag</var> is non-<code>nil</code>, and non-dedicated otherwise. </p> <p>As a special case, if <var>flag</var> is <code>t</code>, <var>window</var> becomes <em>strongly</em> dedicated to its buffer. <code>set-window-buffer</code> signals an error when the window it acts upon is strongly dedicated to its buffer and does not already display the buffer it is asked to display. Other functions do not treat <code>t</code> differently from any non-<code>nil</code> value. </p>
</dd>
</dl> <p>You can also tell <code>display-buffer</code> to mark a window it creates as dedicated to its buffer by providing a suitable <code>dedicated</code> action alist entry (see <a href="buffer-display-action-alists">Buffer Display Action Alists</a>). </p><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 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/Dedicated-Windows.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Dedicated-Windows.html</a>
  </p>
</div>