From: Dan Nicolaescu Date: Tue, 15 Apr 2008 07:28:31 +0000 (+0000) Subject: (vc-status-fileinfo): Add new member directoryp. X-Git-Tag: emacs-pretest-23.0.90~6268 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e8847be332241d666f76c7af28d8e5137468dd67;p=emacs.git (vc-status-fileinfo): Add new member directoryp. (vc-default-status-printer): Print directories. (vc-status-update): Sort files before subdirectories. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7370d00820d..79db7382056 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2008-04-15 Dan Nicolaescu + * vc.el (vc-status-fileinfo): Add new member directoryp. + (vc-default-status-printer): Print directories. + (vc-status-update): Sort files before subdirectories. + * vc-cvs.el (vc-cvs-after-dir-status, vc-cvs-dir-status): Add alternative implementation based on "cvs update". diff --git a/lisp/vc.el b/lisp/vc.el index 42d7b0d9d7e..2626ad6f068 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -2714,7 +2714,9 @@ With prefix arg READ-SWITCHES, specify a value to override extra marked ;; To keep track of not updated files during a global refresh - needs-update) + needs-update + ;; To distinguish files and directories. + directoryp) (defvar vc-status nil) @@ -2738,24 +2740,26 @@ specific headers." (defun vc-default-status-printer (backend fileentry) "Pretty print FILEENTRY." - ;; If you change the layout here, change vc-status-move-to-goal-column. - (let ((state (vc-status-fileinfo->state fileentry))) - (insert - (propertize - (format "%c" (if (vc-status-fileinfo->marked fileentry) ?* ? )) - 'face 'font-lock-type-face) - " " - (propertize - (format "%-20s" state) - 'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face) - ((memq state '(missing conflict)) 'font-lock-warning-face) - (t 'font-lock-variable-name-face)) - 'mouse-face 'highlight) - " " - (propertize - (format "%s" (vc-status-fileinfo->name fileentry)) - 'face 'font-lock-function-name-face - 'mouse-face 'highlight)))) + (if (vc-status-fileinfo->directoryp fileentry) + (insert " Directory: %s" (vc-status-fileinfo->name fileentry)) + ;; If you change the layout here, change vc-status-move-to-goal-column. + (let ((state (vc-status-fileinfo->state fileentry))) + (insert + (propertize + (format "%c" (if (vc-status-fileinfo->marked fileentry) ?* ? )) + 'face 'font-lock-type-face) + " " + (propertize + (format "%-20s" state) + 'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face) + ((memq state '(missing conflict)) 'font-lock-warning-face) + (t 'font-lock-variable-name-face)) + 'mouse-face 'highlight) + " " + (propertize + (format "%s" (vc-status-fileinfo->name fileentry)) + 'face 'font-lock-function-name-face + 'mouse-face 'highlight))))) (defun vc-status-printer (fileentry) (let ((backend (vc-responsible-backend default-directory))) @@ -3019,9 +3023,18 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc." ;; Insert the entries sorted by name into the ewoc. ;; We assume the ewoc is sorted too, which should be the ;; case if we always add entries with vc-status-update. - (setq entries (sort entries - (lambda (entry1 entry2) - (string-lessp (car entry1) (car entry2))))) + (setq entries + ;; Sort: first files and then subdirectories. + ;; XXX: this is VERY inefficient, it computes the directory + ;; names too many times + (sort entries + (lambda (entry1 entry2) + (let ((dir1 (file-name-directory (expand-file-name (car entry1)))) + (dir2 (file-name-directory (expand-file-name (car entry2))))) + (cond + ((string< dir1 dir2) t) + ((not (string= dir1 dir2)) nil) + ((string< (car entry1) (car entry2)))))))) (let ((entry (car entries)) (node (ewoc-nth vc-status 0))) (while (and entry node)