+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
;;
;; 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
(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)
(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)))
'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)
(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
(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.