Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop emacs dired mode from opening so many buffers?

When I use dired mode to browse around and find a file I want to open in Emacs, dired opens a new buffer for each directory I visit when looking for the file each time I select a directory with Enter, which means I can end up with a lot of buffers I don't want:

. * newer                    0  Fundamental       c:/work/stackoverflow/batch/mydir/newer  %  mydir                  302  Dired by name     c:/work/stackoverflow/batch/mydir/  %  batch                  616  Dired by name     c:/work/stackoverflow/batch/  %  stackoverflow         1017  Dired by name     c:/work/stackoverflow/  %  work                  2545  Dired by name     c:/work/   * *scratch*              190  Lisp Interaction  %  *Completions*          162  Completion List   * *Messages*            2163  Fundamental 

Is there any way to make dired re-use a single buffer? I tried M-x customize-group for group dired but didn't see anything promising in there.

Alternatively, does anyone have a macro to close all open dired buffers?

like image 273
Dave Webb Avatar asked Dec 03 '09 11:12

Dave Webb


People also ask

What is Emacs Dired mode?

Dired is the main mode for Emacs file-manager operations. The name “Dired” stands for “directory editor”. A single Dired buffer can display the contents of a single directory, or it can include listings of one or more sub-directories.

How do you use Dired?

To enter into a directory, move to its listing in the Dired buffer, and simply hit the return key. To view a file, you can place the cursor on its entry and use the f or v key, or simply hit the return key.


1 Answers

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

Also, see this page:

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

like image 134
scottfrazer Avatar answered Sep 28 '22 14:09

scottfrazer