From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Browsing into Subdirectory in Dired in the Same Buffer Date: Wed, 29 Oct 2008 12:17:39 +0100 Message-ID: <878ws7k5v0.fsf@thinkpad.tsdh.de> References: <4c61625d-87eb-403b-861b-acaed98505c6@p39g2000hsb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1225279123 20995 80.91.229.12 (29 Oct 2008 11:18:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Oct 2008 11:18:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 29 12:19:44 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kv95Q-0003Kk-N9 for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Oct 2008 12:19:40 +0100 Original-Received: from localhost ([127.0.0.1]:34427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kv94J-0003mz-OC for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Oct 2008 07:18:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kv93p-0003ma-G6 for help-gnu-emacs@gnu.org; Wed, 29 Oct 2008 07:18:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kv93n-0003lU-UT for help-gnu-emacs@gnu.org; Wed, 29 Oct 2008 07:18:00 -0400 Original-Received: from [199.232.76.173] (port=56769 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kv93n-0003lN-IH for help-gnu-emacs@gnu.org; Wed, 29 Oct 2008 07:17:59 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:56985 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kv93n-0005rn-25 for help-gnu-emacs@gnu.org; Wed, 29 Oct 2008 07:17:59 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Kv93h-0002Mo-MX for help-gnu-emacs@gnu.org; Wed, 29 Oct 2008 11:17:53 +0000 Original-Received: from dhcp56.uni-koblenz.de ([141.26.71.56]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Oct 2008 11:17:53 +0000 Original-Received: from tassilo by dhcp56.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Oct 2008 11:17:53 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 43 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dhcp56.uni-koblenz.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:A9JY6pIaQAj0AtqSxmAI9FaYmX0= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59230 Archived-At: "stephan.zimmer" 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.