aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-03-28 03:50:26 +0000
committerDan Nicolaescu2008-03-28 03:50:26 +0000
commit15c5c97086ad7d7e3a40ea15ff3acf947de1e0a2 (patch)
treed1cca4eaf88f9c8cc901203ebee7457feabfec0c
parent1baf9da41e379f50a27d12821e03b132144f09c3 (diff)
downloademacs-15c5c97086ad7d7e3a40ea15ff3acf947de1e0a2.tar.gz
emacs-15c5c97086ad7d7e3a40ea15ff3acf947de1e0a2.zip
* 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.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/vc-git.el12
-rw-r--r--lisp/vc.el16
3 files changed, 33 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 82b606acde8..764d32c9ec9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12008-03-28 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * vc.el: Add new backend function 'status-extra-headers.
4 (vc-default-status-extra-headers): New function.
5 (vc-status-headers): Call 'status-extra-headers. Add colors.
6
7 * vc-git.el (vc-git-status-extra-headers): New function.
8
12008-03-28 Glenn Morris <rgm@gnu.org> 92008-03-28 Glenn Morris <rgm@gnu.org>
2 10
3 * calendar/cal-menu.el (cal-menu-holidays-menu) 11 * calendar/cal-menu.el (cal-menu-holidays-menu)
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 9706afed983..e4150f558ae 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -264,6 +264,18 @@
264 `(vc-git-after-dir-status-stage1 (quote ,update-function) ,status-buffer))) 264 `(vc-git-after-dir-status-stage1 (quote ,update-function) ,status-buffer)))
265 (current-buffer))) 265 (current-buffer)))
266 266
267(defun vc-git-status-extra-headers (dir)
268 (let ((str (with-output-to-string
269 (with-current-buffer standard-output
270 (vc-git--out-ok "symbolic-ref" "HEAD")))))
271 (concat
272 (propertize "Branch : " 'face 'font-lock-type-face)
273 (propertize
274 (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
275 (match-string 2 str)
276 "not (detached HEAD)")
277 'face 'font-lock-variable-name-face))))
278
267;;; STATE-CHANGING FUNCTIONS 279;;; STATE-CHANGING FUNCTIONS
268 280
269(defun vc-git-create-repo () 281(defun vc-git-create-repo ()
diff --git a/lisp/vc.el b/lisp/vc.el
index e3316dce1bd..c2653d90c74 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -182,6 +182,10 @@
182;; change. 182;; change.
183;; This is a replacement for dir-state. 183;; This is a replacement for dir-state.
184;; 184;;
185;; - status-extra-headers (dir)
186;;
187;; Return a string that will be added to the *vc-status* buffer header.
188;;
185;; * working-revision (file) 189;; * working-revision (file)
186;; 190;;
187;; Return the working revision of FILE. This is the revision fetched 191;; 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
2655 2659
2656(defvar vc-status nil) 2660(defvar vc-status nil)
2657 2661
2662(defun vc-default-status-extra-headers (backend dir)
2663 "Extra : Add backend specific headers here")
2664
2658(defun vc-status-headers (backend dir) 2665(defun vc-status-headers (backend dir)
2659 (concat 2666 (concat
2660 (format "VC backend : %s\n" backend) 2667 (propertize "VC backend : " 'face 'font-lock-type-face)
2661 "Repository : The repository goes here\n" 2668 (propertize (format "%s\n" backend) 'face 'font-lock-variable-name-face)
2662 (format "Working dir: %s\n" dir))) 2669 (propertize "Working dir: " 'face 'font-lock-type-face)
2670 (propertize (format "%s\n" dir) 'face 'font-lock-variable-name-face)
2671 (vc-call-backend backend 'status-extra-headers dir)
2672 "\n"))
2663 2673
2664(defun vc-status-printer (fileentry) 2674(defun vc-status-printer (fileentry)
2665 "Pretty print FILEENTRY." 2675 "Pretty print FILEENTRY."