Subject: RE: [External] : bug#36767: 26.1; request: add more quick keys to the *Help* buffer

From: Drew Adams <[email-masked]>
Date: Fri, 18 Jun 2021 16:21:45 +0000

> I'm using this:
> 
> (defun srb-quit-help (&optional any-frame)
>   "Quit *Help* buffer without selecting it.
> With prefix argument ANY-FRAME quit *Help* on any visible frame,
> otherwise quit *Help* buffer only on the selected frame."
>   (interactive "P")
>   (let ((help-window (get-buffer-window "*Help*" (if any-frame 'visible))))
>     (when help-window
>       (with-selected-window help-window (quit-window)))))
> (global-set-key "\C-cq" 'srb-quit-help)
> 
> Of course, if such a command were added to Emacs, it would need a key
> binding not reserved for users, and that's where the real difficulty
> lies.

FWIW, I use this, which I bind to `q' (remap `quit-window'):

;; Candidate as a replacement for `quit-window', at least
;; when used interactively.  For example:
;; (define-key global-map [remap quit-window] 'quit-window-delete)
;;
;; Thanks to Martin Rudalics for suggestions.
;;
(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)))