Subject: RE: [External] : bug#52328: 27.2; [DOC] Paragraph about quit-restore-window

From: Drew Adams <[email-masked]>
Date: Sat, 11 Dec 2021 04:48:42 +0000

I can't speak to what the manual should or shouldn't
say about `quit-restore'.  But since my name was
mentioned I'll just say that I never knowingly or
intentionally use `quit-window' interactively.  I go
out of my way to avoid any use of the `quit-restore'
window parameter.

I replace Emacs's default `quit-window' key bindings,
at least those in libraries I load, with the command
below.

It's close to what `quit-window' used to do, before
Emacs adopted `quit-restore-window'.

(In its doc string, you'll see mention of the option
that Martin mentioned, `frame-auto-hide-function',
which he offered as a way around the imposition by
Emacs of iconifying a window when quitting it or
burying its buffer.) 

(when (fboundp 'quit-restore-window)

  (defun quit-window-delete (&optional kill window)
    "Quit WINDOW, deleting it, and bury its buffer.
WINDOW must be a live window and defaults to the selected one.
With prefix argument KILL non-nil, kill the buffer instead of
burying it.

This is similar to the version of `quit-window' that Emacs had before
the introduction of `quit-restore-window'.  It ignores the information
stored in WINDOW's `quit-restore' window parameter.

It deletes the WINDOW more often, rather than switching to another
buffer in it.  If WINDOW is alone in its frame then the frame is
deleted or iconified, according to option `frame-auto-hide-function'."
    (interactive "P")
    (set-window-parameter
      window 'quit-restore `(frame frame nil ,(current-buffer)))
    (quit-restore-window window (if kill 'kill 'bury)))

  )