[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Browsing into Subdirectory in Dired in the Same Buffer
From: |
Tassilo Horn |
Subject: |
Re: Browsing into Subdirectory in Dired in the Same Buffer |
Date: |
Wed, 29 Oct 2008 12:17:39 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
"stephan.zimmer" <stephan.zimmer@googlemail.com> writes:
Hi!
> When browsing into a subdirectory in dired a new dired buffer is
> opened. Is there an easy way to avoid this, i.e., to let the new
> directory be opened in the same buffer?
Yeah, use `dired-find-alternate-file'. This will reuse the current
buffer. Of course, when using that on a file you'll end up with no
dired buffer at all.
Here's my local hack to make RET reusing the current dired buffer if I'm
hitting RET on a directory or else create a new buffer.
--8<---------------cut here---------------start------------->8---
(put 'dired-find-alternate-file 'disabled nil)
(defun th-dired-up-directory ()
"Go up one directory and don't create a new dired buffer but
reuse the current one."
(interactive)
(find-alternate-file ".."))
(defun th-dired-find-file ()
"Find directory reusing the current buffer and file creating a
new buffer."
(interactive)
(if (file-directory-p (dired-get-file-for-visit))
(dired-find-alternate-file)
(dired-find-file)))
(defun th-dired-mode-init ()
(local-set-key (kbd "^") 'th-dired-up-directory)
(local-set-key (kbd "RET") 'th-dired-find-file))
(add-hook 'dired-mode-hook 'th-dired-mode-init)
--8<---------------cut here---------------end--------------->8---
Hope that helps,
Tassilo
--
Chuck Norris has 12 moons. One of those moons is the Earth.
RE: Browsing into Subdirectory in Dired in the Same Buffer, Drew Adams, 2008/10/29
Re: Browsing into Subdirectory in Dired in the Same Buffer, Joe Casadonte, 2008/10/29