* Keep dired from creating new buffers.
@ 2003-12-12 16:15 Bora
2003-12-12 19:44 ` Yoni Rabkin
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Bora @ 2003-12-12 16:15 UTC (permalink / raw)
Whenever I navigate through (sub)directories in "dired", I get a new buffer
for each directory. This quickly creates a large number of buffers in
emacs. Is there a way to keep dired from doing this, and instead use only
one buffer and update its content if I move through directories.
Thanks
Bora
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Keep dired from creating new buffers.
2003-12-12 16:15 Keep dired from creating new buffers Bora
@ 2003-12-12 19:44 ` Yoni Rabkin
2003-12-15 9:50 ` Sébastien Kirche
2003-12-12 19:55 ` Ekkehard Görlach
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Yoni Rabkin @ 2003-12-12 19:44 UTC (permalink / raw)
Copied verbatim from
http://www.emacswiki.org/cgi-bin/wiki.pl/DiredMode:
Here's the code to make dired use only one buffer:
(eval-after-load "dired"
'(progn
(defadvice dired-advertised-find-file (around dired-subst-directory activate)
"Replace current buffer if file is a directory."
(interactive)
(let* ((orig (current-buffer))
(filename (dired-get-filename))
(bye-p (file-directory-p filename)))
ad-do-it
(when (and bye-p (not (string-match "[/\\\\]\\.$" filename)))
(kill-buffer orig))))))
And here is another way for achieving this:
;; we want dired not not make always a new buffer if visiting a directory
;; but using only one dired buffer for all directories.
(defadvice dired-advertised-find-file (around dired-subst-directory activate)
"Replace current buffer if file is a directory."
(interactive)
(let ((orig (current-buffer))
(filename (dired-get-filename)))
ad-do-it
(when (and (file-directory-p filename)
(not (eq (current-buffer) orig)))
(kill-buffer orig))))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Keep dired from creating new buffers.
2003-12-12 16:15 Keep dired from creating new buffers Bora
2003-12-12 19:44 ` Yoni Rabkin
@ 2003-12-12 19:55 ` Ekkehard Görlach
2003-12-12 19:59 ` Henrik Enberg
2003-12-15 18:15 ` Rob Thorpe
3 siblings, 0 replies; 6+ messages in thread
From: Ekkehard Görlach @ 2003-12-12 19:55 UTC (permalink / raw)
Some time ago somebody posted the following code I have for that in my
.emacs:
;; dired customization
(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 (file-directory-p filename)
(find-alternate-file filename)
(dired-find-file))))
(defun dired-setup-follow-file ()
(substitute-key-definition
'dired-find-file 'dired-follow-file dired-mode-map)
(substitute-key-definition
'dired-advertised-find-file 'dired-follow-file dired-mode-map))
(add-hook 'dired-mode-hook 'dired-setup-follow-file)
HTH,
Ekkehard
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Keep dired from creating new buffers.
2003-12-12 16:15 Keep dired from creating new buffers Bora
2003-12-12 19:44 ` Yoni Rabkin
2003-12-12 19:55 ` Ekkehard Görlach
@ 2003-12-12 19:59 ` Henrik Enberg
2003-12-15 18:15 ` Rob Thorpe
3 siblings, 0 replies; 6+ messages in thread
From: Henrik Enberg @ 2003-12-12 19:59 UTC (permalink / raw)
"Bora" <nobody@nospam.none> writes:
> Whenever I navigate through (sub)directories in "dired", I get a new buffer
> for each directory. This quickly creates a large number of buffers in
> emacs. Is there a way to keep dired from doing this, and instead use only
> one buffer and update its content if I move through directories.
Hit "a" instead of RET on the directory.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Keep dired from creating new buffers.
2003-12-12 16:15 Keep dired from creating new buffers Bora
` (2 preceding siblings ...)
2003-12-12 19:59 ` Henrik Enberg
@ 2003-12-15 18:15 ` Rob Thorpe
3 siblings, 0 replies; 6+ messages in thread
From: Rob Thorpe @ 2003-12-15 18:15 UTC (permalink / raw)
"Bora" <nobody@nospam.none> wrote in message news:<brcpjk$hcr$1@fred.mathworks.com>...
> Whenever I navigate through (sub)directories in "dired", I get a new buffer
> for each directory. This quickly creates a large number of buffers in
> emacs. Is there a way to keep dired from doing this, and instead use only
> one buffer and update its content if I move through directories.
>
> Thanks
> Bora
The most satisfactory method I've found is to use dired like this:
Normally press 'a' on a subdir which replaces the current dired buffer
with the buffer of that subdir.
Use 'enter' when you actually want a new dired buffer, sometimes it's
useful
Use 'i' which inserts the subdir into the current buffer when you know
the directory listing will be fairly short. To remove these when
you've finished use C-u k next to them.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-12-15 18:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-12 16:15 Keep dired from creating new buffers Bora
2003-12-12 19:44 ` Yoni Rabkin
2003-12-15 9:50 ` Sébastien Kirche
2003-12-12 19:55 ` Ekkehard Görlach
2003-12-12 19:59 ` Henrik Enberg
2003-12-15 18:15 ` Rob Thorpe
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).