[ACCEPTED]-How do I stop emacs dired mode from opening so many buffers?-dired

Accepted answer
Score: 69

Use a (dired-find-alternate-file) instead of Enter

Also, see this page:



Score: 15

When browsing in dired instead of hitting 2 enter to see a directory use i then it adds 1 that directory to the current buffer.

Score: 7

I've never managed to get toggle-dired-find-file-reuse-dir 16 to work reliably - I still end up with a 15 variety of dired buffers open, and I'm never 14 quite sure how.

Recently I discovered dired-single 13 (http://www.emacswiki.org/cgi-bin/wiki/dired-single.el) which seems to work better for me. If 12 you want it guarantees a single dired buffer, and 11 also has a nice command dired-single-magic-buffer 10 which will take you to the open dired buffer 9 if you have one, and opens one if you don't.

There 8 are some other alternatives if it isn't 7 the multiple dired buffers per se that annoy, so 6 much as the way they pollute your buffer 5 lists. For example, elscreen.el has a dired 4 plugin that keeps the dired buffers in their 3 own tab, and the excellent ibuffer mode 2 allows you to group dired buffers together 1 when you list buffers.

Hope that helps!


Score: 4

From Xah Lee, at http://ergoemacs.org/emacs/emacs_dired_tips.html

;; Make dired open in the same window when using RET or ^
(put 'dired-find-alternate-file 'disabled nil) ; disables warning
(define-key dired-mode-map (kbd "RET") 'dired-find-alternate-file) ; was dired-advertised-find-file
(define-key dired-mode-map (kbd "^") (lambda () (interactive) (find-alternate-file "..")))  ; was dired-up-directory


Score: 2

Dired+ lets you do this optionally, and it lets 1 you toggle it on/off anytime.

See also http://www.emacswiki.org/emacs/DiredReuseDirectoryBuffer.

Score: 2

In Emacs 28, you can just (setf dired-kill-when-opening-new-dired-buffer t). This works for 1 either dired-find-file (RET) or dired-up-directory (^).

More Related questions