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-git.el,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/lisp/vc-git.el,v
Date: Sat, 25 Aug 2007 20:04:29 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   07/08/25 20:04:28

Index: vc-git.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-git.el,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- vc-git.el   3 Aug 2007 04:57:03 -0000       1.19
+++ vc-git.el   25 Aug 2007 20:04:26 -0000      1.20
@@ -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
@@ -208,6 +208,18 @@
          (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)))




reply via email to

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