From d0cb23caf4c6a1fffaceddecc3eadb80c8948176 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Wed, 30 Jun 2010 15:03:07 -0700 Subject: [PATCH] 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. --- lisp/ChangeLog | 8 ++++++++ lisp/vc-dir.el | 36 ++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 45d12bff8db..e791d21f507 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2010-06-30 Dan Nicolaescu + + 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 * xml.el (xml-parse-region): Avoid infloop (Bug#5281). diff --git a/lisp/vc-dir.el b/lisp/vc-dir.el index 6428e8b9ddb..a32e5b35e08 100644 --- a/lisp/vc-dir.el +++ b/lisp/vc-dir.el @@ -398,22 +398,24 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc." (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 @@ If it is a file, return the corresponding cons for the file itself." (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))))) -- 2.39.2