From: Tassilo Horn <tassilo@member.fsf.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Browsing into Subdirectory in Dired in the Same Buffer
Date: Wed, 29 Oct 2008 12:17:39 +0100 [thread overview]
Message-ID: <878ws7k5v0.fsf@thinkpad.tsdh.de> (raw)
In-Reply-To: 4c61625d-87eb-403b-861b-acaed98505c6@p39g2000hsb.googlegroups.com
"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.
next prev parent reply other threads:[~2008-10-29 11:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-29 8:46 Browsing into Subdirectory in Dired in the Same Buffer stephan.zimmer
2008-10-29 11:17 ` Tassilo Horn [this message]
2008-10-29 11:40 ` Paul R
2008-10-29 13:48 ` Lave
2008-10-29 14:49 ` Tassilo Horn
2008-10-29 15:03 ` Paul R
2008-10-29 23:01 ` Lave
[not found] ` <mailman.2367.1225288108.25473.help-gnu-emacs@gnu.org>
2008-10-29 14:37 ` Xah
2008-10-29 13:35 ` Drew Adams
2008-10-30 2:01 ` Joe Casadonte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878ws7k5v0.fsf@thinkpad.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).