Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dired mode single window? (emacs)

is there a way to have dired operate in a single window so that when I traverse through directories I don't have n number of dired buffers for the intermediate directories? However - if I start another dired buffer in a completely separate directory (from the minibuffer rather than hitting [enter] on a subdirectory in an already open dired instance) I'd like to retain the two separate dired buffers... I guess I'm using ido-dired since I have ido-mode on but I don't know that the solution would be different? Thanks much!

like image 231
hatmatrix Avatar asked Mar 02 '10 10:03

hatmatrix


4 Answers

I reduce the dired-buffer clutter by hitting a (dired-find-alternate-file) on subdirectories, rather than RET; that recycles the current dired window.

like image 71
offby1 Avatar answered Oct 14 '22 23:10

offby1


http://www.emacswiki.org/emacs/dired-single.el

;;; dired-single.el --- Reuse the current dired buffer to visit another directory...

;;; Commentary:
;;
;;  This package provides a way to reuse the current dired buffer to visit
;;  another directory (rather than creating a new buffer for the new directory).
;;  Optionally, it allows the user to specify a name that all such buffers will
;;  have, regardless of the directory they point to...
like image 20
Ilya Khaprov Avatar answered Oct 14 '22 23:10

Ilya Khaprov


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

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

like image 27
Drew Avatar answered Oct 15 '22 01:10

Drew


Like this?

(defadvice dired-find-file (around kill-old-buffer activate)
    "When navigate from one dired buffer to another, kill the old one."
    (let ((old-buffer (current-buffer))
          (new-buffer (dired-get-filename))) 
      ad-do-it
      (kill-buffer old-buffer)
      (switch-to-buffer new-buffer)
))
like image 32
Kilian Foth Avatar answered Oct 15 '22 01:10

Kilian Foth