]> git.eshelyaron.com Git - emacs.git/commitdiff
* vc.el (vc-status-crt-marked): New variable.
authorDan Nicolaescu <dann@ics.uci.edu>
Fri, 29 Feb 2008 19:13:54 +0000 (19:13 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Fri, 29 Feb 2008 19:13:54 +0000 (19:13 +0000)
(vc-status-mode): Make it local.
(vc-status-refresh): Use it to save the marked files.
(vc-update-vc-status-buffer): Use it to restore the marked files.

* vc-svn.el (vc-svn-after-dir-status):
* vc-hg.el (vc-hg-after-dir-status): Clean up the temporary buffer.

lisp/ChangeLog
lisp/vc-hg.el
lisp/vc-hooks.el
lisp/vc-svn.el
lisp/vc.el

index a8bc7f49de533f2802468575152b0958273a2ca3..d3ccff1a4c3b3d8a53e70c4048d14bb563990555 100644 (file)
@@ -1,3 +1,13 @@
+2008-02-29  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * vc.el (vc-status-crt-marked): New variable.
+       (vc-status-mode): Make it local.
+       (vc-status-refresh): Use it to save the marked files.
+       (vc-update-vc-status-buffer): Use it to restore the marked files.
+
+       * vc-svn.el (vc-svn-after-dir-status):
+       * vc-hg.el (vc-hg-after-dir-status): Clean up the temporary buffer.
+
 2008-02-29  Glenn Morris  <rgm@gnu.org>
 
        * allout.el (allout-topic-encryption-bullet)
index db29127e4d20c64e8b80f44f3989e97e2f5540d3..c424dbaa3b6de94c46388cd4cf772e83ce495f56 100644 (file)
@@ -482,7 +482,7 @@ REV is the revision to check out into WORKFILE."
 (define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming")
 
 ;; XXX Experimental function for the vc-dired replacement.
-(defun vc-hg-after-dir-status (update-function buff)
+(defun vc-hg-after-dir-status (update-function status-buffer)
   (let ((status-char nil)
        (file nil)
        (translation '((?= . up-to-date)
@@ -505,7 +505,9 @@ REV is the revision to check out into WORKFILE."
        (when (and translated (not (eq (cdr translated) 'up-to-date)))
          (push (cons file (cdr translated)) result))
        (forward-line))
-      (funcall update-function result buff)))
+      ;; Remove the temporary buffer.
+      (kill-buffer (current-buffer))
+      (funcall update-function result status-buffer)))
 
 ;; XXX Experimental function for the vc-dired replacement.
 (defun vc-hg-dir-status (dir update-function status-buffer)
index b177061d50ad0b1e5c7bd6dbaa3efd8dc94815ec..e167492c089270281dddbc4311131318b3203563 100644 (file)
@@ -605,6 +605,8 @@ If FILE is not registered, this function always returns nil."
 ;; Backward compatibility.
 (define-obsolete-function-alias
   'vc-workfile-version 'vc-working-revision "23.1")
+(define-obsolete-function-alias
+  'vc-previous-version 'vc-previous-revision "23.1")
 (defun vc-default-working-revision (backend file)
   (message
    "`working-revision' not found: using the old `workfile-version' instead")
index 37a5dfb1d3e9e8a7b0632b62d5d17c33c0388bdf..c10aa65f9303bd440b776c97ebd057ac88ed3869 100644 (file)
@@ -175,6 +175,7 @@ If you want to force an empty list of arguments, use t."
            (filename (match-string 2)))
        (when state
          (setq result (cons (cons filename state) result)))))
+    (kill-buffer (current-buffer))
     (funcall callback result buffer)))
 
 (defun vc-svn-dir-status (dir callback buffer)
index 981791ca1b376e1ebcf15c708a8104c0ad58fcd2..ceed375639d6955f34a7a0986d58ba869c8eff91 100644 (file)
@@ -2824,12 +2824,16 @@ With prefix arg READ-SWITCHES, specify a value to override
 (defvar vc-status-process-buffer nil
   "The buffer used for the asynchronous call that computes the VC status.")
 
+(defvar vc-status-crt-marked nil
+  "The list of marked files before `vc-status-refresh'.")
+
 (defun vc-status-mode ()
   "Major mode for VC status.
 \\{vc-status-mode-map}"
   (setq mode-name "*VC Status*")
   (setq major-mode 'vc-status-mode)
   (setq buffer-read-only t)
+  (set (make-local-variable 'vc-status-crt-marked) nil)
   (use-local-map vc-status-mode-map)
   (let ((buffer-read-only nil)
        (backend (vc-responsible-backend default-directory))
@@ -2846,17 +2850,38 @@ With prefix arg READ-SWITCHES, specify a value to override
 (defun vc-update-vc-status-buffer (entries buffer)
   (with-current-buffer buffer
     (when entries
+      ;; Insert the entries we got into the ewoc.
       (dolist (entry entries)
        (ewoc-enter-last vc-status
                         (vc-status-create-fileinfo (cdr entry) (car entry))))
+      ;; 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-map
+        (lambda (arg)
+          (when (member (vc-status-fileinfo->name arg) vc-status-crt-marked)
+            (setf (vc-status-fileinfo->marked arg) t)))
+        vc-status))
       (ewoc-goto-node vc-status (ewoc-nth vc-status 0)))
+    ;; We are done, turn of the in progress message in the mode-line.
     (setq mode-line-process nil)))
 
 (defun vc-status-refresh ()
   "Refresh the contents of the VC status buffer."
   (interactive)
+
   ;; This is not very efficient; ewoc could use a new function here.
+  ;; We clear the ewoc, but remember the marked files so that we can
+  ;; mark them after the refresh is done.
+  (setq vc-status-crt-marked 
+       (mapcar
+        (lambda (elem)
+          (vc-status-fileinfo->name elem))
+        (ewoc-collect
+         vc-status
+         (lambda (crt) (vc-status-fileinfo->marked crt)))))
   (ewoc-filter vc-status (lambda (node) nil))
+
   (let ((backend (vc-responsible-backend default-directory)))
     (vc-set-mode-line-busy-indicator)
     ;; Call the dir-status backend function. dir-status is supposed to