changeset 81815:7ac8c70c6834

* vc-hooks.el (vc-default-mode-line-string): Add a mouse face, mouse binding and a tooltip. * menu-bar.el (vc-menu-map): New defalias.
author Dan Nicolaescu <dann@ics.uci.edu>
date Wed, 11 Jul 2007 18:37:38 +0000
parents d484a8f11257
children 8c1a05c2d668
files lisp/ChangeLog lisp/menu-bar.el lisp/vc-hooks.el
diffstat 3 files changed, 30 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jul 11 15:26:31 2007 +0000
+++ b/lisp/ChangeLog	Wed Jul 11 18:37:38 2007 +0000
@@ -1,3 +1,12 @@
+2007-07-11  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* vc-hooks.el (vc-default-mode-line-string): Add a mouse face,
+	mouse binding and a tooltip.
+
+2007-07-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* menu-bar.el (vc-menu-map): New defalias.
+
 2007-07-10  Jim Meyering  <jim@meyering.net>  (tiny change)
 
 	* emacs-lisp/copyright.el (copyright-current-gpl-version): Set to 3.
--- a/lisp/menu-bar.el	Wed Jul 11 15:26:31 2007 +0000
+++ b/lisp/menu-bar.el	Wed Jul 11 18:37:38 2007 +0000
@@ -1161,6 +1161,7 @@
   '("--"))
 
 (defvar vc-menu-map (make-sparse-keymap "Version Control"))
+(defalias 'vc-menu-map vc-menu-map)
 (define-key menu-bar-tools-menu [pcl-cvs]
   '(menu-item "PCL-CVS" cvs-global-menu))
 (define-key menu-bar-tools-menu [vc]
--- a/lisp/vc-hooks.el	Wed Jul 11 15:26:31 2007 +0000
+++ b/lisp/vc-hooks.el	Wed Jul 11 18:37:38 2007 +0000
@@ -742,17 +742,27 @@
 This function assumes that the file is registered."
   (setq backend (symbol-name backend))
   (let ((state   (vc-state file))
+	(state-echo nil)
 	(rev     (vc-workfile-version file)))
-    (cond ((or (eq state 'up-to-date)
-	       (eq state 'needs-patch))
-	   (concat backend "-" rev))
-          ((stringp state)
-	   (concat backend ":" state ":" rev))
-          (t
-           ;; Not just for the 'edited state, but also a fallback
-           ;; for all other states.  Think about different symbols
-           ;; for 'needs-patch and 'needs-merge.
-           (concat backend ":" rev)))))
+    (propertize
+     (cond ((or (eq state 'up-to-date)
+		(eq state 'needs-patch))
+	    (setq state-echo "Up to date file")
+	    (concat backend "-" rev))
+	   ((stringp state)
+	    (setq state-echo (concat "File locked by" state))
+	    (concat backend ":" state ":" rev))
+	   (t
+	    ;; Not just for the 'edited state, but also a fallback
+	    ;; for all other states.  Think about different symbols
+	    ;; for 'needs-patch and 'needs-merge.
+	    (setq state-echo "Edited file")
+	    (concat backend ":" rev)))
+     'mouse-face 'mode-line-highlight
+     'local-map (let ((map (make-sparse-keymap)))
+		  (define-key map [mode-line down-mouse-1] 'vc-menu-map) map)
+     'help-echo (concat state-echo " under the " backend 
+			" version control system\nmouse-1: VC Menu"))))
 
 (defun vc-follow-link ()
   "If current buffer visits a symbolic link, visit the real file.