changeset 108841:46a99dfe8970

* vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
author Dan Nicolaescu <dann@ics.uci.edu>
date Tue, 01 Jun 2010 00:15:55 -0700
parents bace4ba4c137
children 818b95330703
files lisp/ChangeLog lisp/vc-dir.el
diffstat 2 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon May 31 22:34:49 2010 -0400
+++ b/lisp/ChangeLog	Tue Jun 01 00:15:55 2010 -0700
@@ -1,3 +1,7 @@
+2010-06-01  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* vc-dir.el (vc-dir-update): Remove entries with a nil state (bug#5539).
+
 2010-06-01  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* vc-bzr.el (vc-bzr-revision-completion-table): Apply
--- a/lisp/vc-dir.el	Mon May 31 22:34:49 2010 -0400
+++ b/lisp/vc-dir.el	Tue Jun 01 00:15:55 2010 -0700
@@ -362,6 +362,7 @@
     ;; Insert directory entries in the right places.
     (let ((entry (car entries))
 	  (node (ewoc-nth vc-ewoc 0))
+	  (to-remove nil)
 	  (dotname (file-relative-name default-directory)))
       ;; Insert . if it is not present.
       (unless node
@@ -388,10 +389,16 @@
 	       ((string-lessp nodefile entryfile)
 		(setq node (ewoc-next vc-ewoc node)))
 	       ((string-equal nodefile entryfile)
-		(setf (vc-dir-fileinfo->state (ewoc-data node)) (nth 1 entry))
-		(setf (vc-dir-fileinfo->extra (ewoc-data node)) (nth 2 entry))
-		(setf (vc-dir-fileinfo->needs-update (ewoc-data node)) nil)
-		(ewoc-invalidate vc-ewoc node)
+		(if (nth 1 entry)
+		    (progn
+		      (setf (vc-dir-fileinfo->state (ewoc-data node)) (nth 1 entry))
+		      (setf (vc-dir-fileinfo->extra (ewoc-data node)) (nth 2 entry))
+		      (setf (vc-dir-fileinfo->needs-update (ewoc-data node)) nil)
+		      (ewoc-invalidate vc-ewoc node))
+		  ;; If the state is nil, the file does not exist
+		  ;; anymore, so remember the entry so we can remove
+		  ;; it after we are done inserting all ENTRIES.
+		  (push node to-remove))
 		(setq entries (cdr entries))
 		(setq entry (car entries))
 		(setq node (ewoc-next vc-ewoc node)))
@@ -427,7 +434,10 @@
 		   vc-ewoc (vc-dir-create-fileinfo rd nil nil nil entrydir))))
 	      ;; Now insert the node itself.
 	      (ewoc-enter-last vc-ewoc
-			       (apply 'vc-dir-create-fileinfo entry)))))))))
+			       (apply 'vc-dir-create-fileinfo entry))))))
+      (when to-remove
+	(let ((inhibit-read-only t))
+	  (apply 'ewoc-delete vc-ewoc (nreverse to-remove)))))))
 
 (defun vc-dir-busy ()
   (and (buffer-live-p vc-dir-process-buffer)