Mercurial > emacs
diff lisp/vc.el @ 10140:842f6dc76fc6
(vc-dir-all-files): New function.
(vc-directory): Show just one directory by default.
Read dir name in minibuffer.
(vc-directory-18): Deleted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 10 Dec 1994 09:15:58 +0000 |
parents | 4c632e091d88 |
children | e5638e0a5a60 |
line wrap: on
line diff
--- a/lisp/vc.el Sat Dec 10 07:49:12 1994 +0000 +++ b/lisp/vc.el Sat Dec 10 09:15:58 1994 +0000 @@ -1048,29 +1048,37 @@ (replace-match (concat "\\1" rep "\\2") t))) ))) -;;; Note in Emacs 18 the following defun gets overridden -;;; with the symbol 'vc-directory-18. See below. ;;;###autoload -(defun vc-directory (verbose) - "Show version-control status of all files under the current directory." - (interactive "P") - (let (nonempty - (dl (length default-directory)) - (filelist nil) (userlist nil) - dired-buf - dired-buf-mod-count) - (vc-file-tree-walk - (function (lambda (f) - (if (vc-registered f) - (let ((user (vc-locking-user f))) - (and (or verbose user) - (setq filelist (cons (substring f dl) filelist)) - (setq userlist (cons user userlist)))))))) +(defun vc-directory (dir verbose &optional nested) + "Show version-control status of all files in the directory DIR. +If the second argument VERBOSE is non-nil, show all files; +otherwise show only files that current locked in the version control system. +Interactively, supply a prefix arg to make VERBOSE non-nil. + +If the optional third argument NESTED is non-nil, +scan the entire tree of subdirectories of the current directory." + (interactive "FVC status of directory: \nP") + (let* (nonempty + (dl (length dir)) + (filelist nil) (userlist nil) + dired-buf + dired-buf-mod-count + (subfunction + (function (lambda (f) + (if (vc-registered f) + (let ((user (vc-locking-user f))) + (and (or verbose user) + (setq filelist (cons (substring f dl) filelist)) + (setq userlist (cons user userlist))))))))) + (let ((default-directory dir)) + (if nested + (vc-file-tree-walk subfunction) + (vc-dir-all-files subfunction))) (save-excursion ;; This uses a semi-documented feature of dired; giving a switch ;; argument forces the buffer to refresh each time. (dired - (cons default-directory (nreverse filelist)) + (cons dir (nreverse filelist)) dired-listing-switches) (setq dired-buf (current-buffer)) (setq nonempty (not (zerop (buffer-size))))) @@ -1095,36 +1103,6 @@ (if verbose "registered" "locked") default-directory)) )) -;; Emacs 18 version -(defun vc-directory-18 (verbose) - "Show version-control status of all files under the current directory." - (interactive "P") - (let (nonempty (dir default-directory)) - (save-excursion - (set-buffer (get-buffer-create "*vc-status*")) - (erase-buffer) - (cd dir) - (vc-file-tree-walk - (function (lambda (f) - (if (vc-registered f) - (let ((user (vc-locking-user f))) - (if (or user verbose) - (insert (format - "%s %s\n" - (concat user) f)))))))) - (setq nonempty (not (zerop (buffer-size))))) - (if nonempty - (progn - (pop-to-buffer "*vc-status*" t) - (goto-char (point-min)) - (shrink-window-if-larger-than-buffer))) - (message "No files are currently %s under %s" - (if verbose "registered" "locked") default-directory)) - ) - -(or (boundp 'minor-mode-map-alist) - (fset 'vc-directory 'vc-directory-18)) - ; Emacs 18 also lacks these. (or (boundp 'compilation-old-error-list) (setq compilation-old-error-list nil)) @@ -2069,6 +2047,17 @@ (vc-file-tree-walk-internal dirf func args)))))) (directory-files dir))))) +(defun vc-dir-all-files (func &rest args) + "Invoke FUNC f ARGS on each regular file f in default directory." + (let ((dir default-directory)) + (message "Scanning directory %s..." dir) + (mapcar (function (lambda (f) + (let ((dirf (expand-file-name f dir))) + (if (file-regular-p dirf) + (apply func dirf args))))) + (directory-files dir)) + (message "Scanning directory %s...done" dir))) + (provide 'vc) ;;; DEVELOPER'S NOTES ON CONCURRENCY PROBLEMS IN THIS CODE