# HG changeset patch # User Dan Nicolaescu # Date 1206676226 0 # Node ID 53eee5c271f4902006e37b693345b355b230c51f # Parent bf0cafc88be54b7c4ca3354af5c38c539990f2bb * vc.el: Add new backend function 'status-extra-headers. (vc-default-status-extra-headers): New function. (vc-status-headers): Call 'status-extra-headers. Add colors. * vc-git.el (vc-git-status-extra-headers): New function. diff -r bf0cafc88be5 -r 53eee5c271f4 lisp/ChangeLog --- a/lisp/ChangeLog Fri Mar 28 02:47:59 2008 +0000 +++ b/lisp/ChangeLog Fri Mar 28 03:50:26 2008 +0000 @@ -1,3 +1,11 @@ +2008-03-28 Dan Nicolaescu + + * vc.el: Add new backend function 'status-extra-headers. + (vc-default-status-extra-headers): New function. + (vc-status-headers): Call 'status-extra-headers. Add colors. + + * vc-git.el (vc-git-status-extra-headers): New function. + 2008-03-28 Glenn Morris * calendar/cal-menu.el (cal-menu-holidays-menu) diff -r bf0cafc88be5 -r 53eee5c271f4 lisp/vc-git.el --- a/lisp/vc-git.el Fri Mar 28 02:47:59 2008 +0000 +++ b/lisp/vc-git.el Fri Mar 28 03:50:26 2008 +0000 @@ -264,6 +264,18 @@ `(vc-git-after-dir-status-stage1 (quote ,update-function) ,status-buffer))) (current-buffer))) +(defun vc-git-status-extra-headers (dir) + (let ((str (with-output-to-string + (with-current-buffer standard-output + (vc-git--out-ok "symbolic-ref" "HEAD"))))) + (concat + (propertize "Branch : " 'face 'font-lock-type-face) + (propertize + (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str) + (match-string 2 str) + "not (detached HEAD)") + 'face 'font-lock-variable-name-face)))) + ;;; STATE-CHANGING FUNCTIONS (defun vc-git-create-repo () diff -r bf0cafc88be5 -r 53eee5c271f4 lisp/vc.el --- a/lisp/vc.el Fri Mar 28 02:47:59 2008 +0000 +++ b/lisp/vc.el Fri Mar 28 03:50:26 2008 +0000 @@ -182,6 +182,10 @@ ;; change. ;; This is a replacement for dir-state. ;; +;; - status-extra-headers (dir) +;; +;; Return a string that will be added to the *vc-status* buffer header. +;; ;; * working-revision (file) ;; ;; Return the working revision of FILE. This is the revision fetched @@ -2655,11 +2659,17 @@ (defvar vc-status nil) +(defun vc-default-status-extra-headers (backend dir) + "Extra : Add backend specific headers here") + (defun vc-status-headers (backend dir) (concat - (format "VC backend : %s\n" backend) - "Repository : The repository goes here\n" - (format "Working dir: %s\n" dir))) + (propertize "VC backend : " 'face 'font-lock-type-face) + (propertize (format "%s\n" backend) 'face 'font-lock-variable-name-face) + (propertize "Working dir: " 'face 'font-lock-type-face) + (propertize (format "%s\n" dir) 'face 'font-lock-variable-name-face) + (vc-call-backend backend 'status-extra-headers dir) + "\n")) (defun vc-status-printer (fileentry) "Pretty print FILEENTRY."