changeset 6594:bca9e6c8a07f

(dired-mouse-find-file-other-window): New command. (dired-mode-map): Bind mouse-2.
author Richard M. Stallman <rms@gnu.org>
date Wed, 30 Mar 1994 17:22:59 +0000
parents f7729c7b0aa7
children 7fbc171fd1b5
files lisp/dired.el
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired.el	Wed Mar 30 16:04:08 1994 +0000
+++ b/lisp/dired.el	Wed Mar 30 17:22:59 1994 +0000
@@ -641,13 +641,12 @@
 (defvar dired-mode-map nil "Local keymap for dired-mode buffers.")
 (if dired-mode-map
     nil
-  ;; Force `f' rather than `e' in the mode doc:
-  (defalias 'dired-advertised-find-file 'dired-find-file)
   ;; This looks ugly when substitute-command-keys uses C-d instead d:
   ;;  (define-key dired-mode-map "\C-d" 'dired-flag-file-deletion)
 
   (setq dired-mode-map (make-keymap))
   (suppress-keymap dired-mode-map)
+  (define-key dired-mode-map [mouse-2] 'dired-mouse-find-file-other-window)
   ;; Commands to mark or flag certain categories of files
   (define-key dired-mode-map "#" 'dired-flag-auto-save-files)
   (define-key dired-mode-map "*" 'dired-mark-executables)
@@ -1023,11 +1022,25 @@
 up)
 	  (dired-goto-file dir)))))
 
+;; Force `f' rather than `e' in the mode doc:
+(defalias 'dired-advertised-find-file 'dired-find-file)
 (defun dired-find-file ()
   "In dired, visit the file or directory named on this line."
   (interactive)
   (find-file (file-name-sans-versions (dired-get-filename) t)))
 
+(defun dired-mouse-find-file-other-window (event)
+  "In dired, visit the file or directory name you click on."
+  (interactive "e")
+  (let (file)
+    (save-excursion
+      (set-buffer (window-buffer (posn-window (event-end event))))
+      (save-excursion
+	(goto-char (posn-point (event-end event)))
+	(setq file (dired-get-filename))))
+    (select-window (posn-window (event-end event)))
+    (find-file-other-window (file-name-sans-versions file t))))
+
 (defun dired-view-file ()
   "In dired, examine a file in view mode, returning to dired when done.
 When file is a directory, show it in this buffer if it is inserted;