Commit 3b5e348c authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(vc-dir-all-files): New function.

(vc-directory): Show just one directory by default.
Read dir name in minibuffer.
(vc-directory-18): Deleted.
parent 7904e6e0
...@@ -1048,29 +1048,37 @@ on a buffer attached to the file named in the current Dired buffer line." ...@@ -1048,29 +1048,37 @@ on a buffer attached to the file named in the current Dired buffer line."
(replace-match (concat "\\1" rep "\\2") t))) (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 ;;;###autoload
(defun vc-directory (verbose) (defun vc-directory (dir verbose &optional nested)
"Show version-control status of all files under the current directory." "Show version-control status of all files in the directory DIR.
(interactive "P") If the second argument VERBOSE is non-nil, show all files;
(let (nonempty otherwise show only files that current locked in the version control system.
(dl (length default-directory)) Interactively, supply a prefix arg to make VERBOSE non-nil.
(filelist nil) (userlist nil)
dired-buf If the optional third argument NESTED is non-nil,
dired-buf-mod-count) scan the entire tree of subdirectories of the current directory."
(vc-file-tree-walk (interactive "FVC status of directory: \nP")
(function (lambda (f) (let* (nonempty
(if (vc-registered f) (dl (length dir))
(let ((user (vc-locking-user f))) (filelist nil) (userlist nil)
(and (or verbose user) dired-buf
(setq filelist (cons (substring f dl) filelist)) dired-buf-mod-count
(setq userlist (cons user userlist)))))))) (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 (save-excursion
;; This uses a semi-documented feature of dired; giving a switch ;; This uses a semi-documented feature of dired; giving a switch
;; argument forces the buffer to refresh each time. ;; argument forces the buffer to refresh each time.
(dired (dired
(cons default-directory (nreverse filelist)) (cons dir (nreverse filelist))
dired-listing-switches) dired-listing-switches)
(setq dired-buf (current-buffer)) (setq dired-buf (current-buffer))
(setq nonempty (not (zerop (buffer-size))))) (setq nonempty (not (zerop (buffer-size)))))
...@@ -1095,36 +1103,6 @@ on a buffer attached to the file named in the current Dired buffer line." ...@@ -1095,36 +1103,6 @@ on a buffer attached to the file named in the current Dired buffer line."
(if verbose "registered" "locked") default-directory)) (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. ; Emacs 18 also lacks these.
(or (boundp 'compilation-old-error-list) (or (boundp 'compilation-old-error-list)
(setq compilation-old-error-list nil)) (setq compilation-old-error-list nil))
...@@ -2069,6 +2047,17 @@ Invoke FUNC f ARGS on each non-directory file f underneath it." ...@@ -2069,6 +2047,17 @@ Invoke FUNC f ARGS on each non-directory file f underneath it."
(vc-file-tree-walk-internal dirf func args)))))) (vc-file-tree-walk-internal dirf func args))))))
(directory-files dir))))) (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) (provide 'vc)
;;; DEVELOPER'S NOTES ON CONCURRENCY PROBLEMS IN THIS CODE ;;; DEVELOPER'S NOTES ON CONCURRENCY PROBLEMS IN THIS CODE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment