* 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.
This commit is contained in:
Dan Nicolaescu 2008-03-28 03:50:26 +00:00
parent 1baf9da41e
commit 15c5c97086
3 changed files with 33 additions and 3 deletions

View file

@ -1,3 +1,11 @@
2008-03-28 Dan Nicolaescu <dann@ics.uci.edu>
* 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 <rgm@gnu.org>
* calendar/cal-menu.el (cal-menu-holidays-menu)

View file

@ -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 ()

View file

@ -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 @@ With prefix arg READ-SWITCHES, specify a value to override
(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."