From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Friedrich Dominicus Newsgroups: gmane.emacs.help Subject: Re: Buffers in Dired Date: 02 Jun 2003 07:28:58 +0200 Organization: Q Software Solutions GmbH Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87n0h1t5d1.fsf@fbigm.here> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1054531437 25094 80.91.224.249 (2 Jun 2003 05:23:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 2 Jun 2003 05:23:57 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 02 07:23:55 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19MhnX-0006WZ-00 for ; Mon, 02 Jun 2003 07:23:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Mhp9-0004gL-F1 for gnu-help-gnu-emacs@m.gmane.org; Mon, 02 Jun 2003 01:25:35 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 48 Original-X-Trace: news.t-online.com 1054531347 05 29692 XQAEV4lXSrAUTS 030602 05:22:27 Original-X-Complaints-To: usenet-abuse@t-online.de X-ID: VxROg4Z1gezBOQlSxu4otEt0eV5ty54qqkjcpQkxnrorVvI5EJQN4x User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Native Windows TTY Support) Original-Xref: shelby.stanford.edu gnu.emacs.help:113965 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:10459 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10459 Kaustuv writes: > Hi all, > I am using dired to navigate through the files of my home. But the > problem is the moment i move to a subdirectory dired creates a new > buffer for it. So ultimetly it turns out i have just too many buffers > open if i am locating a file buried deep my home directory sturcture. > Is there some configuration variable which shall tell it not to create > all these buffers but to work only from one buffer. In short all i want > is JUST ONE buffer for all my navigation. > Regards, Someone here posted this code some years? ago ;;;; dired improvements reuse existing buffer instead of generating every-time ;;;; a new one (require 'dired) (defun dired-follow-file () "In dired, visit the file or directory on this line. If a directory is on the current line, replace the current dired buffer with one containing the contents of the directory. Otherwise, invoke `dired-find-file' on the file." (interactive) (let ((filename (dired-get-filename))) ;; if the file is a directory, replace the buffer with the ;; directories contents (if (file-directory-p filename) (find-alternate-file filename) ;; otherwise simply perform a normal `dired-find-file' (dired-find-file)))) with this hooks. ;;;; dired improvement (add-hook 'dired-mode-hook (lambda () (local-set-key [return] 'dired-follow-file) (local-set-key [ e ] 'dired-follow-file) (local-set-key [ v ] 'dired-follow-file) (local-set-key [ f ] 'dired-follow-file))) Use it to your liking. Regards Friedrich