Mercurial > emacs
comparison 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 |
comparison
equal
deleted
inserted
replaced
10139:f9b79337418b | 10140:842f6dc76fc6 |
---|---|
1046 (if (re-search-forward "\\([0-9]+ \\).................\\( .*\\)" nil 0) | 1046 (if (re-search-forward "\\([0-9]+ \\).................\\( .*\\)" nil 0) |
1047 (let ((rep (substring (concat x " ") 0 9))) | 1047 (let ((rep (substring (concat x " ") 0 9))) |
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))))) |
1077 (if nonempty | 1085 (if nonempty |
1078 (progn | 1086 (progn |
1092 (goto-char (point-min)) | 1100 (goto-char (point-min)) |
1093 ) | 1101 ) |
1094 (message "No files are currently %s under %s" | 1102 (message "No files are currently %s under %s" |
1095 (if verbose "registered" "locked") default-directory)) | 1103 (if verbose "registered" "locked") default-directory)) |
1096 )) | 1104 )) |
1097 | |
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 | 1105 |
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)) |
1131 | 1109 |
2067 (or | 2045 (or |
2068 (file-symlink-p dirf) ;; Avoid possible loops | 2046 (file-symlink-p dirf) ;; Avoid possible loops |
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 |
2075 ;;; | 2064 ;;; |
2076 ;;; These may be useful to anyone who has to debug or extend the package. | 2065 ;;; These may be useful to anyone who has to debug or extend the package. |