Next: , Previous: , Up: Windows   [Contents][Index]


38.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 adjacent sibling. (In Emacs version 18, the space was divided evenly among all the siblings.)

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 force

This function removes window from the display. If window is omitted, then the selected window is deleted. If window is the only one on its frame, the frame is deleted as well.

Normally, you cannot delete the last non-minibuffer-only frame (you must use save-buffers-kill-emacs or kill-emacs); an error is signaled instead. However, if optional second argument force is non-nil, you can delete the last frame. (This will automatically call save-buffers-kill-emacs.)

This function returns nil.

When delete-window is called interactively, the selected window is deleted.

Command: delete-other-windows &optional window

This function makes window the only window on its frame, by deleting the other windows in that frame. If window is omitted or nil, then the selected window is used by default.

The result is nil.

Command: delete-windows-on buffer &optional which-frames which-devices

This function deletes all windows showing buffer. If there are no windows showing buffer, it does nothing.

delete-windows-on operates frame by frame. If a frame has several windows showing different buffers, then those showing buffer are removed, and the others expand to fill the space. If all windows in some frame are showing buffer (including the case where there is only one window), then the frame reverts to having a single window showing another buffer chosen with other-buffer. See The Buffer List.

The argument which-frames controls which frames to operate on:

nil

Delete all windows showing buffer in any frame.

t

Delete only windows showing buffer in the selected frame.

visible

Delete all windows showing buffer in any visible frame.

0

Delete all windows showing buffer in any visible frame.

frame

If it is a frame, delete all windows showing buffer in that frame.

Warning: This is similar to, but not identical to, the meaning of the which-frames argument to next-window; the meanings of nil and t are reversed.

The optional argument which-devices further clarifies on which devices to search for frames as specified by which-frames. This value is only meaningful if which-frames is not t.

nil

Consider all devices on the selected console.

device

Consider only the one device device.

console

Consider all devices on console.

device-type

Consider all devices with device type device-type.

window-system

Consider all devices on window system consoles.

anything else

Consider all devices without restriction.

This function always returns nil.


Next: , Previous: , Up: Windows   [Contents][Index]