unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Lave <lave.wang.w@gmail.com>
To: "Tassilo Horn" <tassilo@member.fsf.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Browsing into Subdirectory in Dired in the Same Buffer
Date: Wed, 29 Oct 2008 21:48:23 +0800	[thread overview]
Message-ID: <29de18070810290648l359fac77qa46940927497e748@mail.gmail.com> (raw)
In-Reply-To: <878ws7k5v0.fsf@thinkpad.tsdh.de>

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 <tassilo@member.fsf.org> wrote:
> "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.
>
>
>
>


-- 
Regards,
Lave




  parent reply	other threads:[~2008-10-29 13:48 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
2008-10-29 11:40   ` Paul R
2008-10-29 13:48   ` Lave [this message]
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=29de18070810290648l359fac77qa46940927497e748@mail.gmail.com \
    --to=lave.wang.w@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tassilo@member.fsf.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).