aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-03-30 15:29:35 +0000
committerDan Nicolaescu2008-03-30 15:29:35 +0000
commit58f10bffac5fa90a35685a06f284f5a38d279987 (patch)
treed34b0c4c02a4f43a425e722547cf99d5c3d294a0
parentc9389edfdf5993f1c159311c8032553897b03de5 (diff)
downloademacs-58f10bffac5fa90a35685a06f284f5a38d279987.tar.gz
emacs-58f10bffac5fa90a35685a06f284f5a38d279987.zip
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.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/vc.el34
2 files changed, 39 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 937b98f4c0f..e6bfdbac49a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12008-03-30 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * vc.el: Allow backends to display backend specific information in
4 the vc-status listing.
5 (vc-status-fileinfo): Add a field for backend specific information.
6 (vc-status-printer): Rename to ...
7 (vc-default-status-printer): ... this.
8 (vc-status-printer): New function.
9 (vc-update-vc-status-buffer): Set the backend specific file info
10 if provided.
11
12008-03-30 Stefan Monnier <monnier@iro.umontreal.ca> 122008-03-30 Stefan Monnier <monnier@iro.umontreal.ca>
2 13
3 * textmodes/remember.el (remember-diary-convert-entry): Revert last 14 * textmodes/remember.el (remember-diary-convert-entry): Revert last
diff --git a/lisp/vc.el b/lisp/vc.el
index 43093568f3c..cdd4e2f3ff3 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -183,6 +183,14 @@
183;; 183;;
184;; Return a string that will be added to the *vc-status* buffer header. 184;; Return a string that will be added to the *vc-status* buffer header.
185;; 185;;
186;; - status-printer (fileinfo)
187;;
188;; Pretty print the `vc-status-fileinfo' FILEINFO.
189;; If a backend needs to show more information than the default FILE
190;; and STATE in the vc-status listing, it can store that extra
191;; information in `vc-status-fileinfo->extra'. This function can be
192;; used to display that extra information in the vc-status buffer.
193;;
186;; * working-revision (file) 194;; * working-revision (file)
187;; 195;;
188;; Return the working revision of FILE. This is the revision fetched 196;; Return the working revision of FILE. This is the revision fetched
@@ -2644,11 +2652,14 @@ With prefix arg READ-SWITCHES, specify a value to override
2644 2652
2645(defstruct (vc-status-fileinfo 2653(defstruct (vc-status-fileinfo
2646 (:copier nil) 2654 (:copier nil)
2647 (:constructor vc-status-create-fileinfo (state name &optional marked)) 2655 (:constructor
2656 vc-status-create-fileinfo (name state extra &optional marked))
2648 (:conc-name vc-status-fileinfo->)) 2657 (:conc-name vc-status-fileinfo->))
2649 marked 2658 marked
2650 state 2659 state
2651 name) 2660 name
2661 ;; For storing backend specific information.
2662 extra)
2652 2663
2653(defvar vc-status nil) 2664(defvar vc-status nil)
2654 2665
@@ -2664,7 +2675,7 @@ With prefix arg READ-SWITCHES, specify a value to override
2664 (vc-call-backend backend 'status-extra-headers dir) 2675 (vc-call-backend backend 'status-extra-headers dir)
2665 "\n")) 2676 "\n"))
2666 2677
2667(defun vc-status-printer (fileentry) 2678(defun vc-default-status-printer (backend fileentry)
2668 "Pretty print FILEENTRY." 2679 "Pretty print FILEENTRY."
2669 ;; If you change the layout here, change vc-status-move-to-goal-column. 2680 ;; If you change the layout here, change vc-status-move-to-goal-column.
2670 (let ((state (vc-status-fileinfo->state fileentry))) 2681 (let ((state (vc-status-fileinfo->state fileentry)))
@@ -2685,9 +2696,13 @@ With prefix arg READ-SWITCHES, specify a value to override
2685 'face 'font-lock-function-name-face 2696 'face 'font-lock-function-name-face
2686 'mouse-face 'highlight)))) 2697 'mouse-face 'highlight))))
2687 2698
2699(defun vc-status-printer (fileentry)
2700 (let ((backend (vc-responsible-backend default-directory)))
2701 (vc-call-backend backend 'status-printer fileentry)))
2702
2688(defun vc-status-move-to-goal-column () 2703(defun vc-status-move-to-goal-column ()
2689 (beginning-of-line) 2704 (beginning-of-line)
2690 ;; Must be in sync with vc-status-printer. 2705 ;; Must be in sync with vc-default-status-printer.
2691 (forward-char 25)) 2706 (forward-char 25))
2692 2707
2693(defun vc-status-prepare-status-buffer (dir &optional create-new) 2708(defun vc-status-prepare-status-buffer (dir &optional create-new)
@@ -2918,8 +2933,12 @@ With prefix arg READ-SWITCHES, specify a value to override
2918 (when entries 2933 (when entries
2919 ;; Insert the entries we got into the ewoc. 2934 ;; Insert the entries we got into the ewoc.
2920 (dolist (entry entries) 2935 (dolist (entry entries)
2936 (let* ((file (car entry))
2937 (entrycdr (cdr entry))
2938 (state (if (listp entrycdr) (nth 1 entry)))
2939 (extra (if (listp entrycdr) (nth 2 entry))))
2921 (ewoc-enter-last vc-status 2940 (ewoc-enter-last vc-status
2922 (vc-status-create-fileinfo (cdr entry) (car entry)))) 2941 (vc-status-create-fileinfo file state extra))))
2923 ;; If we had marked items before the refresh, try mark them here. 2942 ;; If we had marked items before the refresh, try mark them here.
2924 ;; XXX: there should be a better way to do this... 2943 ;; XXX: there should be a better way to do this...
2925 (when vc-status-crt-marked 2944 (when vc-status-crt-marked
@@ -2954,7 +2973,10 @@ With prefix arg READ-SWITCHES, specify a value to override
2954 (ewoc-invalidate vc-status crt)) 2973 (ewoc-invalidate vc-status crt))
2955 ;; Could not find the file, insert a new entry. 2974 ;; Could not find the file, insert a new entry.
2956 (ewoc-enter-last 2975 (ewoc-enter-last
2957 vc-status (vc-status-create-fileinfo (cdr entry) (car entry))))))) 2976 ;; XXX: `vc-status-fileinfo->extra' is not set here.
2977 ;; It might need to be.
2978 vc-status
2979 (vc-status-create-fileinfo (car entry) (cdr entry) nil))))))
2958 2980
2959(defun vc-status-refresh () 2981(defun vc-status-refresh ()
2960 "Refresh the contents of the VC status buffer. 2982 "Refresh the contents of the VC status buffer.