By default, dired creates new buffers when visiting new directories. Sometimes this is desired, especially when you need to visualize the contents of two separate directories; however, when you’re just navigating around, all the extra buffers tend to clutter your buffer list.
Typical navigation is done with dired-find-file (bound to f, RET, or e) or dired-find-file-other-window (bound to o). When performed on a directory, this visits the directory in a new dired buffer. In Emacs 22, instead try running dired-find-alternate-file (bound to a). This replaces the current buffer keeping the clutter of dired buffers to a minimum.
When you run dired-find-alternate-file for the first time, you’ll receive a warning that the function is disabled. You can either follow the built-in instructions and customizations to enable the function, or you can add the following to your .emacs.
(put 'dired-find-alternate-file 'disabled nil)
Bibliography
GNU Emacs Manual, Visiting Files in Dired
EmacsWiki, DiredReuseDirectoryBuffer — includes other ways to enable similar behavior in Emacs 21.
1 response so far ↓
I always figured it was possible, but never got around to looking into it. Thanks!
Leave a Comment