elisp: Deleting Windows

 
 27.7 Deleting Windows
 =====================
 
 “Deleting” a window removes it from the frame’s window tree.  If the
 window is a live window, it disappears from the screen.  If the window
 is an internal window, its child windows are deleted too.
 
    Even after a window is deleted, it continues to exist as a Lisp
 object, until there are no more references to it.  Window deletion can
 be reversed, by restoring a saved window configuration (SeeWindow
 Configurations).
 
  -- Command: delete-window &optional window
      This function removes WINDOW from display and returns ‘nil’.  If
      WINDOW is omitted or ‘nil’, it defaults to the selected window.  If
      deleting the window would leave no more windows in the window tree
      (e.g., if it is the only live window in the frame), an error is
      signaled.
 
      By default, the space taken up by WINDOW is given to one of its
      adjacent sibling windows, if any.  However, if the variable
      ‘window-combination-resize’ is non-‘nil’, the space is
      proportionally distributed among any remaining windows in the same
      window combination.  SeeRecombining Windows.
 
      The behavior of this function may be altered by the window
      parameters of WINDOW, so long as the variable
      ‘ignore-window-parameters’ is ‘nil’.  If the value of the
      ‘delete-window’ window parameter is ‘t’, this function ignores all
      other window parameters.  Otherwise, if the value of the
      ‘delete-window’ window parameter is a function, that function is
      called with the argument WINDOW, in lieu of the usual action of
      ‘delete-window’.  Otherwise, this function obeys the ‘window-atom’
      or ‘window-side’ window parameter, if any.  SeeWindow
      Parameters.
 
  -- Command: delete-other-windows &optional window
      This function makes WINDOW fill its frame, by deleting other
      windows as necessary.  If WINDOW is omitted or ‘nil’, it defaults
      to the selected window.  The return value is ‘nil’.
 
      The behavior of this function may be altered by the window
      parameters of WINDOW, so long as the variable
      ‘ignore-window-parameters’ is ‘nil’.  If the value of the
      ‘delete-other-windows’ window parameter is ‘t’, this function
      ignores all other window parameters.  Otherwise, if the value of
      the ‘delete-other-windows’ window parameter is a function, that
      function is called with the argument WINDOW, in lieu of the usual
      action of ‘delete-other-windows’.  Otherwise, this function obeys
      the ‘window-atom’ or ‘window-side’ window parameter, if any.  See
      Window Parameters.
 
  -- Command: delete-windows-on &optional buffer-or-name frame
      This function deletes all windows showing BUFFER-OR-NAME, by
      calling ‘delete-window’ on those windows.  BUFFER-OR-NAME should be
      a buffer, or the name of a buffer; if omitted or ‘nil’, it defaults
      to the current buffer.  If there are no windows showing the
      specified buffer, this function does nothing.  If the specified
      buffer is a minibuffer, an error is signaled.
 
      If there is a dedicated window showing the buffer, and that window
      is the only one on its frame, this function also deletes that frame
      if it is not the only frame on the terminal.
 
      The optional argument FRAME specifies which frames to operate on:
 
         • ‘nil’ means operate on all frames.
         • ‘t’ means operate on the selected frame.
         • ‘visible’ means operate on all visible frames.
         • ‘0’ means operate on all visible or iconified frames.
         • A frame means operate on that frame.
 
      Note that this argument does not have the same meaning as in other
      functions which scan all live windows (SeeCyclic Window
      Ordering).  Specifically, the meanings of ‘t’ and ‘nil’ here are
      the opposite of what they are in those other functions.