changeset 30108:d78375eda4e8

(dired-find-alternate-file): New function. (dired-mode-map): Bind `a' to dired-find-alternate-file. (toplevel): Require dired-aux when compiling. (dired-buffers): Move defvar within file to avoid compiler warning.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 07 Jul 2000 13:00:21 +0000
parents 5753fb56a074
children 310914da7811
files lisp/dired.el
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired.el	Fri Jul 07 10:23:51 2000 +0000
+++ b/lisp/dired.el	Fri Jul 07 13:00:21 2000 +0000
@@ -33,6 +33,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'dired-aux))
+
 ;;; Customizable variables
 
 (defgroup dired nil
@@ -561,6 +563,12 @@
     (set-buffer old-buf)
     buffer))
 
+(defvar dired-buffers nil
+  ;; Enlarged by dired-advertise
+  ;; Queried by function dired-buffers-for-dir. When this detects a
+  ;; killed buffer, it is removed from this list.
+  "Alist of expanded directories and their associated dired buffers.")
+
 (defun dired-find-buffer-nocreate (dirname &optional mode)
   ;; This differs from dired-buffers-for-dir in that it does not consider
   ;; subdirs of default-directory and searches for the first match only.
@@ -917,6 +925,7 @@
     (define-key map "*\C-p" 'dired-prev-marked-file)
     (define-key map "*t" 'dired-do-toggle)
     ;; Lower keys for commands not operating on all the marked files
+    (define-key map "a" 'dired-find-alternate-file)
     (define-key map "d" 'dired-flag-file-deletion)
     (define-key map "e" 'dired-find-file)
     (define-key map "f" 'dired-find-file)
@@ -1343,6 +1352,12 @@
 	  (error "File is a symlink to a nonexistent target")
 	(error "File no longer exists; type `g' to update Dired buffer")))))
 
+(defun dired-find-alternate-file ()
+  "In dired, visit this file or directory instead of the dired buffer."
+  (interactive)
+  (set-buffer-modified-p nil)
+  (find-alternate-file (dired-get-filename)))
+
 (defun dired-mouse-find-file-other-window (event)
   "In dired, visit the file or directory name you click on."
   (interactive "e")
@@ -1585,12 +1600,6 @@
 
 ;; Keeping Dired buffers in sync with the filesystem and with each other
 
-(defvar dired-buffers nil
-  ;; Enlarged by dired-advertise
-  ;; Queried by function dired-buffers-for-dir. When this detects a
-  ;; killed buffer, it is removed from this list.
-  "Alist of expanded directories and their associated dired buffers.")
-
 (defun dired-buffers-for-dir (dir &optional file)
 ;; Return a list of buffers that dired DIR (top level or in-situ subdir).
 ;; If FILE is non-nil, include only those whose wildcard pattern (if any)