Subject: Re: bug#38818: Dired: mention deleting buffers, not just windows

From: Michael Heerdegen <[email-masked]>
Date: Wed, 01 Jan 2020 05:53:43 +0100

積丹尼 Dan Jacobson <[email-masked]> writes:

> OK, I'll use
> (add-hook
>  'dired-load-hook
>  (function
>   (lambda ()
>     (load "dired-x")
>     (define-key dired-mode-map "q" 'kill-current-buffer)
>     )))
> until something more fancy is invented.

Slightly better version:

(add-hook
 'dired-load-hook
 (defun my-dired-load-hook-fun ()
   (require 'dired-x)
   (define-key dired-mode-map "q" #'kill-current-buffer)))

-- a named function can't accidentally be added multiple times to a
hook, lambda already self-quotes, and `require' doesn't unnecessarily
reload a file.

BTW, the q binding in dired-mode-map originates from special-mode-map
from which dired-mode-map inherits.  These are all bindings that it inherits:

SPC		scroll-up-command
-		negative-argument
0 .. 9		digit-argument
<		beginning-of-buffer
>		end-of-buffer
?		describe-mode
g		revert-buffer
h		describe-mode
q		quit-window
DEL		scroll-down-command
S-SPC		scroll-down-command
<remap>		Prefix Command

So the q binding is somewhat standard, and other modes may share your
problem.

Ok, I can't help further, I don't want to propose a solution.

Michael.