Function: projectile-discover-projects-in-directory
projectile-discover-projects-in-directory is an autoloaded,
interactive and byte-compiled function defined in projectile.el.
Signature
(projectile-discover-projects-in-directory DIRECTORY &optional DEPTH)
Documentation
Discover any projects in DIRECTORY and add them to the projectile cache.
If DEPTH is non-nil recursively descend exactly DEPTH levels below DIRECTORY and discover projects there.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
;;;###autoload
(defun projectile-discover-projects-in-directory (directory &optional depth)
"Discover any projects in DIRECTORY and add them to the projectile cache.
If DEPTH is non-nil recursively descend exactly DEPTH levels below DIRECTORY and
discover projects there."
(interactive
(list (read-directory-name "Starting directory: ")))
;; set a default value for depth
(setq depth (or depth 1))
(if (file-directory-p directory)
(if (and (numberp depth) (> depth 0))
;; Ignore errors when listing files in the directory, because
;; sometimes that directory is an unreadable one at the root of a
;; volume. This is the case, for example, on macOS with the
;; .Spotlight-V100 directory.
(let ((progress-reporter
(make-progress-reporter
(format "Projectile is discovering projects in %s..."
(propertize directory 'face 'font-lock-keyword-face)))))
(progress-reporter-update progress-reporter)
(dolist (dir (ignore-errors
(directory-files directory t
directory-files-no-dot-files-regexp)))
(when (and (file-directory-p dir)
;; Don't walk into remote trees during discovery -
;; that would issue a TRAMP round-trip per directory.
(not (file-remote-p dir)))
(projectile-discover-projects-in-directory dir (1- depth))))
(progress-reporter-done progress-reporter))
(when (projectile-project-p directory)
(let ((dir (projectile--known-project-root (projectile-project-root directory))))
(unless (member dir projectile-known-projects)
(projectile-add-known-project dir)))))
(if (called-interactively-p 'interactive)
(message "Search path directory %s doesn't exist" directory)
(projectile--message "Search path directory %s doesn't exist" directory))))