emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/vc.el,v


From: Sam Steingold
Subject: [Emacs-diffs] Changes to emacs/lisp/vc.el,v
Date: Fri, 02 May 2008 14:37:42 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Sam Steingold <sds>     08/05/02 14:37:40

Index: vc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc.el,v
retrieving revision 1.611
retrieving revision 1.612
diff -u -b -r1.611 -r1.612
--- vc.el       2 May 2008 07:47:18 -0000       1.611
+++ vc.el       2 May 2008 14:37:39 -0000       1.612
@@ -2991,10 +2991,8 @@
     (define-key map "q" 'quit-window)
     (define-key map "g" 'vc-dir-refresh)
     (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process)
-    ;; Does not work unless mouse sets point.  Functions like vc-dir-find-file
-    ;; need to find the file from the mouse position, not `point'.
-    ;; (define-key map [(down-mouse-3)] 'vc-dir-menu)
-    ;; (define-key map [(mouse-2)] 'vc-dir-toggle-mark)
+    (define-key map [(down-mouse-3)] 'vc-dir-menu)
+    (define-key map [(mouse-2)] 'vc-dir-toggle-mark)
 
     ;; Hook up the menu.
     (define-key map [menu-bar vc-dir-mode]
@@ -3022,10 +3020,21 @@
              '("----")
              ext-binding))))
 
+(defmacro vc-at-event (event &rest body)
+  "Evaluate `body' wich point located at event-start of `event'.
+If `body' uses `event', it should be a variable,
+ otherwise it will be evaluated twice."
+  (let ((posn (gensym "vc-at-event-posn")))
+    `(let ((,posn (event-start ,event)))
+       (save-excursion
+         (set-buffer (window-buffer (posn-window ,posn)))
+         (goto-char (posn-point ,posn))
+         ,@body))))
+
 (defun vc-dir-menu (e)
   "Popup the VC status menu."
   (interactive "e")
-  (popup-menu vc-dir-menu-map e))
+  (vc-at-event e (popup-menu vc-dir-menu-map e)))
 
 (defvar vc-dir-tool-bar-map
   (let ((map (make-sparse-keymap)))
@@ -3416,7 +3425,7 @@
              (and (not isdir) (not (vc-dir-parent-marked-p crt))))
       (setf (vc-dir-fileinfo->marked file) t)
       (ewoc-invalidate vc-ewoc crt)
-      (unless arg
+      (unless (or arg (mouse-event-p last-command-event))
        (vc-dir-next-line 1)))))
 
 (defun vc-dir-mark ()
@@ -3481,7 +3490,8 @@
          (file (ewoc-data crt)))
     (setf (vc-dir-fileinfo->marked file) nil)
     (ewoc-invalidate vc-ewoc crt)
-    (vc-dir-next-line 1)))
+    (unless (mouse-event-p last-command-event)
+      (vc-dir-next-line 1))))
 
 (defun vc-dir-unmark ()
   "Unmark the current file or all files in the region.
@@ -3545,9 +3555,9 @@
        (vc-dir-unmark-file)
       (vc-dir-mark-file))))
 
-(defun vc-dir-toggle-mark ()
-  (interactive)
-  (vc-dir-mark-unmark 'vc-dir-toggle-mark-file))
+(defun vc-dir-toggle-mark (e)
+  (interactive "e")
+  (vc-at-event e (vc-dir-mark-unmark 'vc-dir-toggle-mark-file)))
 
 (defun vc-dir-register ()
   "Register the marked files, or the current file if no marks."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]