Mercurial > emacs
changeset 93425:8459d55c7312
Allow backends to display backend specific information in
the vc-status listing.
(vc-status-fileinfo): Add a field for backend specific information.
(vc-status-printer): Rename to ...
(vc-default-status-printer): ... this.
(vc-status-printer): New function.
(vc-update-vc-status-buffer): Set the backend specific file info
if provided.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sun, 30 Mar 2008 15:29:35 +0000 |
parents | bc6b2ba17b08 |
children | 912e50ecb992 |
files | lisp/ChangeLog lisp/vc.el |
diffstat | 2 files changed, 39 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun Mar 30 14:42:47 2008 +0000 +++ b/lisp/ChangeLog Sun Mar 30 15:29:35 2008 +0000 @@ -1,3 +1,14 @@ +2008-03-30 Dan Nicolaescu <dann@ics.uci.edu> + + * vc.el: Allow backends to display backend specific information in + the vc-status listing. + (vc-status-fileinfo): Add a field for backend specific information. + (vc-status-printer): Rename to ... + (vc-default-status-printer): ... this. + (vc-status-printer): New function. + (vc-update-vc-status-buffer): Set the backend specific file info + if provided. + 2008-03-30 Stefan Monnier <monnier@iro.umontreal.ca> * textmodes/remember.el (remember-diary-convert-entry): Revert last
--- a/lisp/vc.el Sun Mar 30 14:42:47 2008 +0000 +++ b/lisp/vc.el Sun Mar 30 15:29:35 2008 +0000 @@ -183,6 +183,14 @@ ;; ;; Return a string that will be added to the *vc-status* buffer header. ;; +;; - status-printer (fileinfo) +;; +;; Pretty print the `vc-status-fileinfo' FILEINFO. +;; If a backend needs to show more information than the default FILE +;; and STATE in the vc-status listing, it can store that extra +;; information in `vc-status-fileinfo->extra'. This function can be +;; used to display that extra information in the vc-status buffer. +;; ;; * working-revision (file) ;; ;; Return the working revision of FILE. This is the revision fetched @@ -2644,11 +2652,14 @@ (defstruct (vc-status-fileinfo (:copier nil) - (:constructor vc-status-create-fileinfo (state name &optional marked)) + (:constructor + vc-status-create-fileinfo (name state extra &optional marked)) (:conc-name vc-status-fileinfo->)) marked state - name) + name + ;; For storing backend specific information. + extra) (defvar vc-status nil) @@ -2664,7 +2675,7 @@ (vc-call-backend backend 'status-extra-headers dir) "\n")) -(defun vc-status-printer (fileentry) +(defun vc-default-status-printer (backend fileentry) "Pretty print FILEENTRY." ;; If you change the layout here, change vc-status-move-to-goal-column. (let ((state (vc-status-fileinfo->state fileentry))) @@ -2685,9 +2696,13 @@ 'face 'font-lock-function-name-face 'mouse-face 'highlight)))) +(defun vc-status-printer (fileentry) + (let ((backend (vc-responsible-backend default-directory))) + (vc-call-backend backend 'status-printer fileentry))) + (defun vc-status-move-to-goal-column () (beginning-of-line) - ;; Must be in sync with vc-status-printer. + ;; Must be in sync with vc-default-status-printer. (forward-char 25)) (defun vc-status-prepare-status-buffer (dir &optional create-new) @@ -2918,8 +2933,12 @@ (when entries ;; Insert the entries we got into the ewoc. (dolist (entry entries) + (let* ((file (car entry)) + (entrycdr (cdr entry)) + (state (if (listp entrycdr) (nth 1 entry))) + (extra (if (listp entrycdr) (nth 2 entry)))) (ewoc-enter-last vc-status - (vc-status-create-fileinfo (cdr entry) (car entry)))) + (vc-status-create-fileinfo file state extra)))) ;; If we had marked items before the refresh, try mark them here. ;; XXX: there should be a better way to do this... (when vc-status-crt-marked @@ -2954,7 +2973,10 @@ (ewoc-invalidate vc-status crt)) ;; Could not find the file, insert a new entry. (ewoc-enter-last - vc-status (vc-status-create-fileinfo (cdr entry) (car entry))))))) + ;; XXX: `vc-status-fileinfo->extra' is not set here. + ;; It might need to be. + vc-status + (vc-status-create-fileinfo (car entry) (cdr entry) nil)))))) (defun vc-status-refresh () "Refresh the contents of the VC status buffer.