changeset 101692:e9aa71a1b711

(vc-dir-mouse-map): New keymap. (vc-default-dir-printer): Use it locally. (vc-dir-find-file-other-window): Allow mouse events.
author Nick Roberts <nickrob@snap.net.nz>
date Sat, 31 Jan 2009 02:18:21 +0000
parents 6066300ce217
children d8e498f22523
files lisp/vc-dir.el
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc-dir.el	Sat Jan 31 02:15:14 2009 +0000
+++ b/lisp/vc-dir.el	Sat Jan 31 02:18:21 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-input-event))
+  (if event (posn-set-point (event-end event)))
   (find-file-other-window (vc-dir-current-file)))
 
 (defun vc-dir-isearch ()
@@ -1143,6 +1144,13 @@
    (propertize "Please add backend specific headers here.  It's easy!"
 	       'face 'font-lock-warning-face)))
 
+;; Keep existing map.
+(defvar vc-dir-mouse-map
+  (let ((map vc-dir-mode-map))
+    (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.
@@ -1169,7 +1177,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
+      'local-map vc-dir-mouse-map))))
 
 (defun vc-default-extra-status-menu (backend)
   nil)