diff options
| author | Richard M. Stallman | 1994-12-10 09:15:58 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-12-10 09:15:58 +0000 |
| commit | 3b5e348cccdb0bc8208ee488b863ddc4fcc6a6c0 (patch) | |
| tree | f577b61aa28d9af175fd09a01bbb62311da7f04f | |
| parent | 7904e6e0c60d13050c87266222ec80a7211ac3e5 (diff) | |
| download | emacs-3b5e348cccdb0bc8208ee488b863ddc4fcc6a6c0.tar.gz emacs-3b5e348cccdb0bc8208ee488b863ddc4fcc6a6c0.zip | |
(vc-dir-all-files): New function.
(vc-directory): Show just one directory by default.
Read dir name in minibuffer.
(vc-directory-18): Deleted.
| -rw-r--r-- | lisp/vc.el | 85 |
1 files changed, 37 insertions, 48 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index f15bbdb927b..b80f632a413 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -1048,29 +1048,37 @@ on a buffer attached to the file named in the current Dired buffer line." | |||
| 1048 | (replace-match (concat "\\1" rep "\\2") t))) | 1048 | (replace-match (concat "\\1" rep "\\2") t))) |
| 1049 | ))) | 1049 | ))) |
| 1050 | 1050 | ||
| 1051 | ;;; Note in Emacs 18 the following defun gets overridden | ||
| 1052 | ;;; with the symbol 'vc-directory-18. See below. | ||
| 1053 | ;;;###autoload | 1051 | ;;;###autoload |
| 1054 | (defun vc-directory (verbose) | 1052 | (defun vc-directory (dir verbose &optional nested) |
| 1055 | "Show version-control status of all files under the current directory." | 1053 | "Show version-control status of all files in the directory DIR. |
| 1056 | (interactive "P") | 1054 | If the second argument VERBOSE is non-nil, show all files; |
| 1057 | (let (nonempty | 1055 | otherwise show only files that current locked in the version control system. |
| 1058 | (dl (length default-directory)) | 1056 | Interactively, supply a prefix arg to make VERBOSE non-nil. |
| 1059 | (filelist nil) (userlist nil) | 1057 | |
| 1060 | dired-buf | 1058 | If the optional third argument NESTED is non-nil, |
| 1061 | dired-buf-mod-count) | 1059 | scan the entire tree of subdirectories of the current directory." |
| 1062 | (vc-file-tree-walk | 1060 | (interactive "FVC status of directory: \nP") |
| 1063 | (function (lambda (f) | 1061 | (let* (nonempty |
| 1064 | (if (vc-registered f) | 1062 | (dl (length dir)) |
| 1065 | (let ((user (vc-locking-user f))) | 1063 | (filelist nil) (userlist nil) |
| 1066 | (and (or verbose user) | 1064 | dired-buf |
| 1067 | (setq filelist (cons (substring f dl) filelist)) | 1065 | dired-buf-mod-count |
| 1068 | (setq userlist (cons user userlist)))))))) | 1066 | (subfunction |
| 1067 | (function (lambda (f) | ||
| 1068 | (if (vc-registered f) | ||
| 1069 | (let ((user (vc-locking-user f))) | ||
| 1070 | (and (or verbose user) | ||
| 1071 | (setq filelist (cons (substring f dl) filelist)) | ||
| 1072 | (setq userlist (cons user userlist))))))))) | ||
| 1073 | (let ((default-directory dir)) | ||
| 1074 | (if nested | ||
| 1075 | (vc-file-tree-walk subfunction) | ||
| 1076 | (vc-dir-all-files subfunction))) | ||
| 1069 | (save-excursion | 1077 | (save-excursion |
| 1070 | ;; This uses a semi-documented feature of dired; giving a switch | 1078 | ;; This uses a semi-documented feature of dired; giving a switch |
| 1071 | ;; argument forces the buffer to refresh each time. | 1079 | ;; argument forces the buffer to refresh each time. |
| 1072 | (dired | 1080 | (dired |
| 1073 | (cons default-directory (nreverse filelist)) | 1081 | (cons dir (nreverse filelist)) |
| 1074 | dired-listing-switches) | 1082 | dired-listing-switches) |
| 1075 | (setq dired-buf (current-buffer)) | 1083 | (setq dired-buf (current-buffer)) |
| 1076 | (setq nonempty (not (zerop (buffer-size))))) | 1084 | (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 | (if verbose "registered" "locked") default-directory)) | 1103 | (if verbose "registered" "locked") default-directory)) |
| 1096 | )) | 1104 | )) |
| 1097 | 1105 | ||
| 1098 | ;; Emacs 18 version | ||
| 1099 | (defun vc-directory-18 (verbose) | ||
| 1100 | "Show version-control status of all files under the current directory." | ||
| 1101 | (interactive "P") | ||
| 1102 | (let (nonempty (dir default-directory)) | ||
| 1103 | (save-excursion | ||
| 1104 | (set-buffer (get-buffer-create "*vc-status*")) | ||
| 1105 | (erase-buffer) | ||
| 1106 | (cd dir) | ||
| 1107 | (vc-file-tree-walk | ||
| 1108 | (function (lambda (f) | ||
| 1109 | (if (vc-registered f) | ||
| 1110 | (let ((user (vc-locking-user f))) | ||
| 1111 | (if (or user verbose) | ||
| 1112 | (insert (format | ||
| 1113 | "%s %s\n" | ||
| 1114 | (concat user) f)))))))) | ||
| 1115 | (setq nonempty (not (zerop (buffer-size))))) | ||
| 1116 | (if nonempty | ||
| 1117 | (progn | ||
| 1118 | (pop-to-buffer "*vc-status*" t) | ||
| 1119 | (goto-char (point-min)) | ||
| 1120 | (shrink-window-if-larger-than-buffer))) | ||
| 1121 | (message "No files are currently %s under %s" | ||
| 1122 | (if verbose "registered" "locked") default-directory)) | ||
| 1123 | ) | ||
| 1124 | |||
| 1125 | (or (boundp 'minor-mode-map-alist) | ||
| 1126 | (fset 'vc-directory 'vc-directory-18)) | ||
| 1127 | |||
| 1128 | ; Emacs 18 also lacks these. | 1106 | ; Emacs 18 also lacks these. |
| 1129 | (or (boundp 'compilation-old-error-list) | 1107 | (or (boundp 'compilation-old-error-list) |
| 1130 | (setq compilation-old-error-list nil)) | 1108 | (setq compilation-old-error-list nil)) |
| @@ -2069,6 +2047,17 @@ Invoke FUNC f ARGS on each non-directory file f underneath it." | |||
| 2069 | (vc-file-tree-walk-internal dirf func args)))))) | 2047 | (vc-file-tree-walk-internal dirf func args)))))) |
| 2070 | (directory-files dir))))) | 2048 | (directory-files dir))))) |
| 2071 | 2049 | ||
| 2050 | (defun vc-dir-all-files (func &rest args) | ||
| 2051 | "Invoke FUNC f ARGS on each regular file f in default directory." | ||
| 2052 | (let ((dir default-directory)) | ||
| 2053 | (message "Scanning directory %s..." dir) | ||
| 2054 | (mapcar (function (lambda (f) | ||
| 2055 | (let ((dirf (expand-file-name f dir))) | ||
| 2056 | (if (file-regular-p dirf) | ||
| 2057 | (apply func dirf args))))) | ||
| 2058 | (directory-files dir)) | ||
| 2059 | (message "Scanning directory %s...done" dir))) | ||
| 2060 | |||
| 2072 | (provide 'vc) | 2061 | (provide 'vc) |
| 2073 | 2062 | ||
| 2074 | ;;; DEVELOPER'S NOTES ON CONCURRENCY PROBLEMS IN THIS CODE | 2063 | ;;; DEVELOPER'S NOTES ON CONCURRENCY PROBLEMS IN THIS CODE |