From: Alexandre Julliard Date: Mon, 14 Apr 2008 15:22:47 +0000 (+0000) Subject: (vc-status-update): Undo the previous revert. X-Git-Tag: emacs-pretest-23.0.90~6281 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1f3e0cb5d235369585c9bb1c5fcca0b52d2ef7fd;p=emacs.git (vc-status-update): Undo the previous revert. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 90090c66784..07babb88d4b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2008-04-14 Alexandre Julliard + + * vc.el (vc-status-update): Undo the previous revert. + 2008-04-14 Stefan Monnier * minibuffer.el (completion-table-with-terminator): Those completions diff --git a/lisp/vc.el b/lisp/vc.el index 5435c53e621..e946191a0e0 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -3011,8 +3011,9 @@ specific headers." (put 'vc-status-mode 'mode-class 'special) -(defun vc-status-update (entries buffer) - "Update BUFFER's ewoc from the list of ENTRIES." +(defun vc-status-update (entries buffer &optional noinsert) + "Update BUFFER's ewoc from the list of ENTRIES. +If NOINSERT, ignore elements on ENTRIES which are not in the ewoc." ;; Add ENTRIES to the vc-status buffer BUFFER. (with-current-buffer buffer ;; Insert the entries sorted by name into the ewoc. @@ -3021,28 +3022,30 @@ specific headers." (setq entries (sort entries (lambda (entry1 entry2) (string-lessp (car entry1) (car entry2))))) - (let ((entry (pop entries)) - (node (ewoc-nth vc-status 0))) - (while entry - (let ((file (car entry))) - ;; Note: we always keep node pointing to the last inserted entry - ;; in order to catch duplicates in the entries list - (cond ((not node) - (setq node (ewoc-enter-last vc-status - (apply 'vc-status-create-fileinfo entry))) - (setq entry (pop entries))) - ((string-lessp (vc-status-fileinfo->name (ewoc-data node)) file) - (setq node (ewoc-next vc-status node))) - ((string-equal (vc-status-fileinfo->name (ewoc-data node)) file) - (setf (vc-status-fileinfo->state (ewoc-data node)) (nth 1 entry)) - (setf (vc-status-fileinfo->extra (ewoc-data node)) (nth 2 entry)) - (setf (vc-status-fileinfo->needs-update (ewoc-data node)) nil) - (ewoc-invalidate vc-status node) - (setq entry (pop entries))) - (t - (setq node (ewoc-enter-before vc-status node - (apply 'vc-status-create-fileinfo entry))) - (setq entry (pop entries))))))))) + (let ((entry (car entries)) + (node (ewoc-nth vc-status 0))) + (while (and entry node) + (let ((entryfile (car entry)) + (nodefile (vc-status-fileinfo->name (ewoc-data node)))) + (cond + ((string-lessp nodefile entryfile) + (setq node (ewoc-next vc-status node))) + ((string-lessp nodefile entryfile) + (unless noinsert + (ewoc-enter-before vc-status node + (apply 'vc-status-create-fileinfo entry))) + (setq entries (cdr entries) entry (car entries))) + (t + (setf (vc-status-fileinfo->state (ewoc-data node)) (nth 1 entry)) + (setf (vc-status-fileinfo->extra (ewoc-data node)) (nth 2 entry)) + (ewoc-invalidate vc-status node) + (setq entries (cdr entries) entry (car entries)) + (setq node (ewoc-next vc-status node)))))) + (unless (or node noinsert) + ;; We're past the last node, all remaining entries go to the end. + (while entries + (ewoc-enter-last vc-status + (apply 'vc-status-create-fileinfo (pop entries)))))))) (defun vc-status-busy () (and (buffer-live-p vc-status-process-buffer)