1

If I press 'q' in Dired this buries the current buffer. I would prefer to have 'q' kill the buffer. Hence, I would like to bind the command "kill-this-buffer" to 'q' in Dired. Is this possible and advisable?

0

1 Answer 1

2

Is this possible?: Yes.

Is this advisable?: Emacs is meant to be configurable and custom tailored to the needs of each particular user. There is no disadvantage that I am aware of to rebinding the "q" key to something that the O.P. finds more useful.

(require 'dired)
(define-key dired-mode-map "q" 'kill-this-buffer)
2
  • 3
    More idiomatic would be: (with-eval-after-load 'dired (define-key dired-mode-map "q" 'kill-this-buffer))
    – clemera
    Commented Dec 29, 2019 at 19:41
  • "Is this advisable?" The answer is: "probably not" . 'quit-window is bound to "q" and should be left as is. My suggestion to OP is to define another key to 'kill-this-buffer, for instance, the letter "K" is available.
    – Robert
    Commented Jan 19, 2021 at 9:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.