]> git.eshelyaron.com Git - emacs.git/commitdiff
* vc-git.el (vc-git-mode-line-string): New function.
authorDan Nicolaescu <dann@ics.uci.edu>
Sat, 25 Aug 2007 20:04:26 +0000 (20:04 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Sat, 25 Aug 2007 20:04:26 +0000 (20:04 +0000)
lisp/ChangeLog
lisp/vc-git.el

index d81cf3a4691e4a3600158e131fea04fc1c63772c..1e061579124575c910628450b16cfe2ee12022f6 100644 (file)
@@ -1,3 +1,7 @@
+2007-08-25  Alexandre Julliard  <julliard@winehq.org>
+
+       * vc-git.el (vc-git-mode-line-string): New function.
+
 2007-08-25  Alan Mackenzie  <acm@muc.de>
 
        * progmodes/cc-langs.el (c-other-decl-block-key-in-symbols-alist):
index 156b2866eb9cb138de33e7fb3ab8fed1b4a51050..32d8d48299cb1222f487e8e3e6f4ba8be941acd4 100644 (file)
@@ -57,7 +57,7 @@
 ;; - latest-on-branch-p (file)                    NOT NEEDED
 ;; * checkout-model (file)                        OK
 ;; - workfile-unchanged-p (file)                  OK
-;; - mode-line-string (file)                      NOT NEEDED
+;; - mode-line-string (file)                      OK
 ;; - dired-state-info (file)                      OK
 ;; STATE-CHANGING FUNCTIONS
 ;; * create-repo ()                               OK
          (string-match "[0-7]\\{6\\} blob \\([0-9a-f]\\{40\\}\\)\t[^\0]+\0" head)
          (string= (car (split-string sha1 "\n")) (match-string 1 head)))))
 
+(defun vc-git-mode-line-string (file)
+  "Return string for placement into the modeline for FILE."
+  (let* ((branch (vc-git-workfile-version file))
+         (def-ml (vc-default-mode-line-string 'Git file))
+         (help-echo (get-text-property 0 'help-echo def-ml)))
+    (if (zerop (length branch))
+        (propertize
+         (concat def-ml "!")
+         'help-echo (concat help-echo "\nNo current branch (detached HEAD)"))
+      (propertize def-ml
+                  'help-echo (concat help-echo "\nCurrent branch: " branch)))))
+
 (defun vc-git-dired-state-info (file)
   "Git-specific version of `vc-dired-state-info'."
   (let ((git-state (vc-state file)))