ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial

28.9 Dedicated Windows

Functions for displaying a buffer can be told to not use specific windows by marking these windows as dedicated to their buffers. display-buffer (see Choosing Window) never uses a dedicated window for displaying another buffer in it. get-lru-window and get-largest-window (see Selecting Windows) do not consider dedicated windows as candidates when their dedicated argument is non-nil. The behavior of set-window-buffer (see Buffers and Windows) with respect to dedicated windows is slightly different, see below.

When delete-windows-on (see Deleting Windows) wants to delete a dedicated window and that window is the only window on its frame, it deletes the window's frame too, provided there are other frames left. replace-buffer-in-windows (see Displaying Buffers) tries to delete all dedicated windows showing its buffer argument. When such a window is the only window on its frame, that frame is deleted, provided there are other frames left. If there are no more frames left, some other buffer is displayed in the window, and the window is marked as non-dedicated.

When you kill a buffer (see Killing Buffers) displayed in a dedicated window, any such window usually gets deleted too, since kill-buffer calls replace-buffer-in-windows for cleaning up windows. Burying a buffer (see The Buffer List) deletes the selected window if it is dedicated to that buffer. If, however, that window is the only window on its frame, bury-buffer displays another buffer in it and iconifies the frame.

— Function: window-dedicated-p &optional window

This function returns non-nil if window is dedicated to its buffer and nil otherwise. More precisely, the return value is the value assigned by the last call of set-window-dedicated-p for window or nil if that function was never called with window as its argument. The default for window is the selected window.

— Function: set-window-dedicated-p window flag

This function marks window as dedicated to its buffer if flag is non-nil, and non-dedicated otherwise.

As a special case, if flag is t, window becomes strongly dedicated to its buffer. set-window-buffer 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 t differently from any non-nil value.

blog comments powered by Disqus