From c5753a5d97bbe9a3d91b8f11dd49119cd0fbeefe Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Fri, 7 Jul 2000 13:00:21 +0000 Subject: [PATCH] (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. --- lisp/dired.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lisp/dired.el b/lisp/dired.el index c7cd894c1e1..e042bf6fc54 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -33,6 +33,8 @@ ;;; Code: +(eval-when-compile (require 'dired-aux)) + ;;; Customizable variables (defgroup dired nil @@ -561,6 +563,12 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." (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 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." (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 @@ Creates a buffer if necessary." (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 @@ regardless of the language.") ;; 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) -- 2.39.2