ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial
Web Hosting by 1&1

28.3 Deleting Windows

A window remains visible on its frame unless you delete it by calling certain functions that delete windows. A deleted window cannot appear on the screen, but continues to exist as a Lisp object until there are no references to it. There is no way to cancel the deletion of a window aside from restoring a saved window configuration (see Window Configurations). Restoring a window configuration also deletes any windows that aren't part of that configuration.

When you delete a window, the space it took up is given to one of its sibling windows adjacent to it.

— Function: window-live-p window

This function returns nil if window is deleted, and t otherwise.

Warning: Erroneous information or fatal errors may result from using a deleted window as if it were live.

— Command: delete-window &optional window

This function removes window from display and returns nil. The default for window is the selected window. An error is signaled if window is the only window on its frame.

— Command: delete-other-windows &optional window

This function makes window the only window on its frame, by deleting the other windows in that frame. The default for window is the selected window. The return value is nil.

— Command: delete-windows-on &optional buffer-or-name frame

This function deletes all windows showing buffer-or-name. If there are no windows showing buffer-or-name, it does nothing. The optional argument buffer-or-name may be a buffer or the name of an existing buffer and defaults to the current buffer.

delete-windows-on operates frame by frame. If a frame has several windows showing different buffers, then those showing buffer-or-name are removed, and the others expand to fill the space. If all windows in some frame are showing buffer-or-name (including the case where there is only one window), then the frame winds up with a single window showing another buffer chosen with other-buffer (see The Buffer List). If, however, the window showing buffer-or-name is dedicated to its buffer (see Dedicated Windows), and there are other frames left, that window's frame is deleted.

The optional argument frame specifies which frames to operate on. This function does not use it in quite the same way as the other functions which scan all windows; specifically, the values t and nil have the opposite of their meanings in other functions. Here are the full details:

This function always returns nil.

blog comments powered by Disqus