changeset 101924:c1950714465b

(vc-dir-find-file-other-window): Allow mouse events. (vc-dir-mouse-map): New keymap. (vc-default-dir-printer): Use it locally.
author Nick Roberts <nickrob@snap.net.nz>
date Tue, 10 Feb 2009 05:51:47 +0000
parents 50624469b15a
children 4eaca528c43f
files lisp/vc-dir.el
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc-dir.el	Tue Feb 10 05:26:52 2009 +0000
+++ b/lisp/vc-dir.el	Tue Feb 10 05:51:47 2009 +0000
@@ -689,9 +689,10 @@
   (interactive)
   (find-file (vc-dir-current-file)))
 
-(defun vc-dir-find-file-other-window ()
+(defun vc-dir-find-file-other-window (&optional event)
   "Find the file on the current line, in another window."
-  (interactive)
+  (interactive (list last-nonmenu-event))
+  (if event (posn-set-point (event-end event)))
   (find-file-other-window (vc-dir-current-file)))
 
 (defun vc-dir-isearch ()
@@ -1145,6 +1146,12 @@
    (propertize "Please add backend specific headers here.  It's easy!"
 	       'face 'font-lock-warning-face)))
 
+(defvar vc-dir-mouse-map
+   (let ((map (make-sparse-keymap)))
+     (define-key map [mouse-2] 'vc-dir-find-file-other-window)
+    map)
+  "Local keymap for visiting a file.")
+
 (defun vc-default-dir-printer (backend fileentry)
   "Pretty print FILEENTRY."
   ;; If you change the layout here, change vc-dir-move-to-goal-column.
@@ -1171,7 +1178,8 @@
       (if isdir
 	  "Directory\nVC operations can be applied to it\nmouse-3: Pop-up menu"
 	"File\nmouse-3: Pop-up menu")
-      'mouse-face 'highlight))))
+      'mouse-face 'highlight
+      'keymap vc-dir-mouse-map))))
 
 (defun vc-default-extra-status-menu (backend)
   nil)