Subject: bug#76248: [Feature Request] user-option for killing buffer in `quit-window'.

From: Stefan Kangas <[email-masked]>
Date: Wed, 12 Feb 2025 23:25:56 -0800

Juri Linkov <[email-masked]> writes:

>> Hello, i would like to know why there is not an user-option for the
>> `quit-window' function to kill windows instead burying them.
>>
>> I find this useful in buffers like `help-mode' to avoid filling
>> list-buffers with unnecessary buffers.
>>
>> I'm currently using an `advice' to achieve this:
>>
>>   (advice-add #'quit-window :around
>>               (lambda (orig-fn _ &rest window)
>>                 (funcall orig-fn 't window)))
>>
>> and honestly I would prefer an option like: "quit-window-kill-buffer"
>> (set to `nil' by default).
>
> I completely agree.  The lack of this option causes so much trouble.

Sounds useful, agreed.  Why not have the option.

> For example, I needed to define in the init file:
>
>   (defun quit-window-kill-buffer ()
>     "Quit WINDOW and kill its buffer."
>     (interactive)
>     (quit-window 1))
>
> and then update each and every keymap to override 'quit-window'
> with 'quit-window-kill-buffer':
>
>   (define-key archive-mode-map "q" 'quit-window-kill-buffer)
>   (define-key tar-mode-map "q" 'quit-window-kill-buffer)
>   (define-key dired-mode-map "q" 'quit-window-kill-buffer)
>   ...

(Maybe an advice could work for this?)