diff options
| -rw-r--r-- | lisp/progmodes/project.el | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index a6426c08840..95db9d0ef4c 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -1866,35 +1866,28 @@ the progress. The function returns the number of detected | |||
| 1866 | projects." | 1866 | projects." |
| 1867 | (interactive "DDirectory: \nP") | 1867 | (interactive "DDirectory: \nP") |
| 1868 | (project--ensure-read-project-list) | 1868 | (project--ensure-read-project-list) |
| 1869 | (let ((queue (list dir)) | 1869 | (let ((dirs (if recursive |
| 1870 | (count 0) | 1870 | (directory-files-recursively dir "" t) |
| 1871 | (known (make-hash-table | 1871 | (directory-files dir t))) |
| 1872 | :size (* 2 (length project--list)) | 1872 | (known (make-hash-table :size (* 2 (length project--list)) |
| 1873 | :test #'equal ))) | 1873 | :test #'equal)) |
| 1874 | (count 0)) | ||
| 1874 | (dolist (project (mapcar #'car project--list)) | 1875 | (dolist (project (mapcar #'car project--list)) |
| 1875 | (puthash project t known)) | 1876 | (puthash project t known)) |
| 1876 | (while queue | 1877 | (dolist (subdir dirs) |
| 1877 | (when-let ((subdir (pop queue)) | 1878 | (when-let (((file-directory-p subdir)) |
| 1878 | ((file-directory-p subdir))) | 1879 | (project (project--find-in-directory subdir)) |
| 1879 | (when-let ((project (project--find-in-directory subdir)) | 1880 | (project-root (project-root project)) |
| 1880 | (project-root (project-root project)) | 1881 | ((not (gethash project-root known)))) |
| 1881 | ((not (gethash project-root known)))) | 1882 | (project-remember-project project t) |
| 1882 | (project-remember-project project t) | 1883 | (puthash project-root t known) |
| 1883 | (puthash project-root t known) | 1884 | (message "Found %s..." project-root) |
| 1884 | (message "Found %s..." project-root) | 1885 | (setq count (1+ count)))) |
| 1885 | (setq count (1+ count))) | 1886 | (if (zerop count) |
| 1886 | (when (and recursive (file-directory-p subdir)) | 1887 | (message "No projects were found") |
| 1887 | (setq queue | 1888 | (project--write-project-list) |
| 1888 | (nconc | 1889 | (message "%d project%s were found" |
| 1889 | (directory-files | 1890 | count (if (= count 1) "" "s"))) |
| 1890 | subdir t directory-files-no-dot-files-regexp t) | ||
| 1891 | queue))))) | ||
| 1892 | (unless (eq recursive 'in-progress) | ||
| 1893 | (if (zerop count) | ||
| 1894 | (message "No projects were found") | ||
| 1895 | (project--write-project-list) | ||
| 1896 | (message "%d project%s were found" | ||
| 1897 | count (if (= count 1) "" "s")))) | ||
| 1898 | count)) | 1891 | count)) |
| 1899 | 1892 | ||
| 1900 | (defun project-forget-zombie-projects () | 1893 | (defun project-forget-zombie-projects () |