help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keep dired from creating new buffers.


From: Ekkehard Görlach
Subject: Re: Keep dired from creating new buffers.
Date: Fri, 12 Dec 2003 20:55:52 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]