all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Friedrich Dominicus <frido@q-software-solutions.com>
Subject: Re: Buffers in Dired
Date: 02 Jun 2003 07:28:58 +0200	[thread overview]
Message-ID: <87n0h1t5d1.fsf@fbigm.here> (raw)
In-Reply-To: m3r86fqaas.fsf_-_@crayt3e.stanford.edu

Kaustuv <kaustuv@stanford.edu> 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

  parent reply	other threads:[~2003-06-02  5:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-31 17:46 Buffers in Dired Kaustuv
2003-05-31 19:48 ` Kai Großjohann
2003-05-31 20:33 ` Johan Bockgård
2003-05-31 21:43 ` Ed Cavazos
2003-06-01  3:36   ` Galen Boyer
2003-06-01  7:19     ` Peter Lee
2003-06-01 16:19       ` Buffers in Dired (Thanks) Kaustuv
2003-06-01 17:53       ` Buffers in Dired Galen Boyer
2003-06-01 18:05       ` Matthias Meulien
2003-06-02  5:28 ` Friedrich Dominicus [this message]
2003-06-02  6:00 ` David Masterson

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87n0h1t5d1.fsf@fbigm.here \
    --to=frido@q-software-solutions.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.