diff options
author | Dan Nicolaescu <dann@ics.uci.edu> | 2007-08-25 20:04:26 +0000 |
---|---|---|
committer | Dan Nicolaescu <dann@ics.uci.edu> | 2007-08-25 20:04:26 +0000 |
commit | 6f222162a7b840f73ad4e645af5bcdf5649ef7b8 (patch) | |
tree | a3e7c38ad4129a25612b5683997fbd97bde6aa7b /lisp/vc-git.el | |
parent | 02df5de4cad21eb7125d32da5d1f18b62bb143b3 (diff) | |
download | emacs-6f222162a7b840f73ad4e645af5bcdf5649ef7b8.tar.gz emacs-6f222162a7b840f73ad4e645af5bcdf5649ef7b8.tar.bz2 emacs-6f222162a7b840f73ad4e645af5bcdf5649ef7b8.zip |
* vc-git.el (vc-git-mode-line-string): New function.
Diffstat (limited to 'lisp/vc-git.el')
-rw-r--r-- | lisp/vc-git.el | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 156b2866eb9..32d8d48299c 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el @@ -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))) |