From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lave Newsgroups: gmane.emacs.help Subject: Re: Browsing into Subdirectory in Dired in the Same Buffer Date: Wed, 29 Oct 2008 21:48:23 +0800 Message-ID: <29de18070810290648l359fac77qa46940927497e748@mail.gmail.com> References: <4c61625d-87eb-403b-861b-acaed98505c6@p39g2000hsb.googlegroups.com> <878ws7k5v0.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1225288167 21723 80.91.229.12 (29 Oct 2008 13:49:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Oct 2008 13:49:27 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Tassilo Horn" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 29 14:50:28 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 1KvBQl-0006lu-B0 for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Oct 2008 14:49:51 +0100 Original-Received: from localhost ([127.0.0.1]:54145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KvBPf-000837-5y for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Oct 2008 09:48:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KvBPP-00082I-1K for help-gnu-emacs@gnu.org; Wed, 29 Oct 2008 09:48:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KvBPN-00080f-I9 for help-gnu-emacs@gnu.org; Wed, 29 Oct 2008 09:48:26 -0400 Original-Received: from [199.232.76.173] (port=59400 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KvBPN-00080W-EN for help-gnu-emacs@gnu.org; Wed, 29 Oct 2008 09:48:25 -0400 Original-Received: from rv-out-0708.google.com ([209.85.198.242]:18034) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KvBPM-0002XE-OV for help-gnu-emacs@gnu.org; Wed, 29 Oct 2008 09:48:25 -0400 Original-Received: by rv-out-0708.google.com with SMTP id k29so3891676rvb.6 for ; Wed, 29 Oct 2008 06:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=pRdpyAtgA9+rYJpd5X9Yxm4PPx9mIzdZMZHj2Qe3aRg=; b=kKfb5MP6ETGMDa9YbbuseTrebdkPSW2Y6OUF91F++h1tYUc/Ytgw1l3KK+khRoY8EO z9c7yze7i+HXqppdQZ4rmU7rF4pyBgEMcJf0yNHJKirmZ2snlxgazl+mlX6mhh7v9bmL OlUxw/Ec074LGuGAkwykFWk5iDWrfvXIn66e8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=QjhOa1uRoYy0EUhmHTklh+LSFVekhfSE3cvyu3nyx98XCkBUotK8kpA7Q0ItC+GgaY a0DmLEGVC/ZK6c+u+/j0HYRB0MdPnPRmcVMnSUY6gmpmzlfAfJGU9I7OswQmTV+yiRv3 k6Q1kWg6cBzx3BgcXrGkfFKIKK6j9T+dFKWcA= Original-Received: by 10.141.171.6 with SMTP id y6mr4902320rvo.85.1225288103416; Wed, 29 Oct 2008 06:48:23 -0700 (PDT) Original-Received: by 10.141.40.2 with HTTP; Wed, 29 Oct 2008 06:48:23 -0700 (PDT) In-Reply-To: <878ws7k5v0.fsf@thinkpad.tsdh.de> Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:59234 Archived-At: It's nice. I copied it, thanks. But, I used to 'v' to view a directory, and 'q' buried it, then I can see the previous again, although there are too many buffers. Is there a method to go back the previous viewed directory? On 10/29/08, Tassilo Horn wrote: > "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. > > > > -- Regards, Lave