changeset 109289:ef318d39a3e6

Avoid displaying files with a nil state in vc-dir. * lisp/vc-dir.el (vc-dir-update): Obey the noinsert argument in all cases that cause insertion. (vc-dir-resynch-file): Tell vc-dir-update to avoid inserting files with a nil state.
author Dan Nicolaescu <dann@ics.uci.edu>
date Wed, 30 Jun 2010 15:03:07 -0700
parents e24d55cee016
children 1b5ca039f5f2
files lisp/ChangeLog lisp/vc-dir.el
diffstat 2 files changed, 28 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jun 30 16:34:06 2010 -0400
+++ b/lisp/ChangeLog	Wed Jun 30 15:03:07 2010 -0700
@@ -1,3 +1,11 @@
+2010-06-30  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	Avoid displaying files with a nil state in vc-dir.
+	* vc-dir.el (vc-dir-update): Obey the noinsert argument in all
+	cases that cause insertion.
+	(vc-dir-resynch-file): Tell vc-dir-update to avoid inserting files
+	with a nil state.
+
 2010-06-30  Chong Yidong  <cyd@stupidchicken.com>
 
 	* xml.el (xml-parse-region): Avoid infloop (Bug#5281).
--- a/lisp/vc-dir.el	Wed Jun 30 16:34:06 2010 -0400
+++ b/lisp/vc-dir.el	Wed Jun 30 15:03:07 2010 -0700
@@ -398,22 +398,24 @@
 		(setq entry (car entries))
 		(setq node (ewoc-next vc-ewoc node)))
 	       (t
-		(ewoc-enter-before vc-ewoc node
-				   (apply 'vc-dir-create-fileinfo entry))
+		(unless noinsert
+		  (ewoc-enter-before vc-ewoc node
+				     (apply 'vc-dir-create-fileinfo entry)))
 		(setq entries (cdr entries))
 		(setq entry (car entries))))))
 	   (t
-	    ;; We might need to insert a directory node if the
-	    ;; previous node was in a different directory.
-	    (let* ((rd (file-relative-name entrydir))
-		   (prev-node (ewoc-prev vc-ewoc node))
-		   (prev-dir (vc-dir-node-directory prev-node)))
-	      (unless (string-equal entrydir prev-dir)
-		(ewoc-enter-before
-		 vc-ewoc node (vc-dir-create-fileinfo rd nil nil nil entrydir))))
-	    ;; Now insert the node itself.
-	    (ewoc-enter-before vc-ewoc node
-			       (apply 'vc-dir-create-fileinfo entry))
+	    (unless noinsert
+	      ;; We might need to insert a directory node if the
+	      ;; previous node was in a different directory.
+	      (let* ((rd (file-relative-name entrydir))
+		     (prev-node (ewoc-prev vc-ewoc node))
+		     (prev-dir (vc-dir-node-directory prev-node)))
+		(unless (string-equal entrydir prev-dir)
+		  (ewoc-enter-before
+		   vc-ewoc node (vc-dir-create-fileinfo rd nil nil nil entrydir))))
+	      ;; Now insert the node itself.
+	      (ewoc-enter-before vc-ewoc node
+				 (apply 'vc-dir-create-fileinfo entry)))
 	    (setq entries (cdr entries) entry (car entries))))))
       ;; We're past the last node, all remaining entries go to the end.
       (unless (or node noinsert)
@@ -888,10 +890,12 @@
 		      (vc-dir-resync-directory-files file)
 		      (ewoc-set-hf vc-ewoc
 				   (vc-dir-headers vc-dir-backend default-directory) ""))
-                  (let ((state (vc-dir-recompute-file-state file ddir)))
+                  (let* ((complete-state (vc-dir-recompute-file-state file ddir))
+			 (state (cadr complete-state)))
                     (vc-dir-update
-                     (list state)
-                     status-buf (eq (cadr state) 'up-to-date))))))))))
+                     (list complete-state)
+                     status-buf (or (not state)
+				    (eq state 'up-to-date)))))))))))
     ;; Remove out-of-date entries from vc-dir-buffers.
     (dolist (b drop) (setq vc-dir-buffers (delq b vc-dir-buffers)))))