changeset 82070:62454e8b7dd5

(vc-mode-line-map): New const. (vc-mode-line): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 23 Jul 2007 21:07:03 +0000
parents ed4cade83fcc
children dd207a898aee
files lisp/ChangeLog lisp/vc-hooks.el
diffstat 2 files changed, 32 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Jul 23 20:57:14 2007 +0000
+++ b/lisp/ChangeLog	Mon Jul 23 21:07:03 2007 +0000
@@ -1,3 +1,8 @@
+2007-07-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* vc-hooks.el (vc-mode-line-map): New const.
+	(vc-mode-line): Use it.
+
 2007-07-23  Alexandre Julliard <julliard@winehq.org>
 
 	* vc-git.el (vc-git-delete-file, vc-git-rename-file)
@@ -39,7 +44,8 @@
 
 2007-07-23  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-	* emacs-lisp/copyright.el (copyright-update-year): Fix 2007-05-25 change.
+	* emacs-lisp/copyright.el (copyright-update-year): Fix 2007-05-25
+	change by reverting a small part.
 
 2007-07-23  Richard Stallman  <rms@gnu.org>
 
@@ -59,9 +65,9 @@
 
 2007-07-20  Kenichi Handa  <handa@m17n.org>
 
-	* international/utf-8.el (utf-8-post-read-conversion): Temporarily
-	bind utf-8-compose-scripts to nil while running *-compose-region
-	functions.
+	* international/utf-8.el (utf-8-post-read-conversion):
+	Temporarily bind utf-8-compose-scripts to nil while running
+	*-compose-region functions.
 
 2007-07-23  Dan Nicolaescu  <dann@ics.uci.edu>
 
--- a/lisp/vc-hooks.el	Mon Jul 23 20:57:14 2007 +0000
+++ b/lisp/vc-hooks.el	Mon Jul 23 21:07:03 2007 +0000
@@ -716,34 +716,35 @@
 	     ;; any VC Dired buffer to synchronize.
 	     (vc-dired-resynch-file file)))))
 
+(defconst vc-mode-line-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [mode-line down-mouse-1] 'vc-menu-map)
+    map))
+
 (defun vc-mode-line (file)
   "Set `vc-mode' to display type of version control for FILE.
 The value is set in the current buffer, which should be the buffer
 visiting FILE."
   (interactive (list buffer-file-name))
-  (let ((backend (vc-backend file))
-	ml-string ml-echo)
+  (let ((backend (vc-backend file)))
     (if (not backend)
 	(setq vc-mode nil)
-      (setq ml-string (vc-call mode-line-string file))
-      (setq ml-echo (get-text-property 0 'help-echo ml-string))
-      (setq vc-mode
-	    (concat
-	     " "
-	     (if vc-display-status
-		 (propertize
-		  ml-string
-		  'mouse-face 'mode-line-highlight
-		  'help-echo
-		  (concat (if ml-echo
-			      ml-echo
-			    (format "File under the %s version control system"
-				    backend))
-			  "\nmouse-1: Version Control menu")
-		  'local-map (let ((map (make-sparse-keymap)))
-			       (define-key map [mode-line down-mouse-1]
-				 'vc-menu-map) map))
-	       (symbol-name backend))))
+      (let* ((ml-string (vc-call mode-line-string file))
+             (ml-echo (get-text-property 0 'help-echo ml-string)))
+        (setq vc-mode
+              (concat
+               " "
+               (if (null vc-display-status)
+                   (symbol-name backend)
+                 (propertize
+                  ml-string
+                  'mouse-face 'mode-line-highlight
+                  'help-echo 
+                  (concat (or ml-echo
+                              (format "File under the %s version control system"
+                                      backend))
+                          "\nmouse-1: Version Control menu")
+                  'local-map vc-mode-line-map)))))
       ;; If the file is locked by some other user, make
       ;; the buffer read-only.  Like this, even root
       ;; cannot modify a file that someone else has locked.