Function: projectile-detect-project-type

projectile-detect-project-type is a byte-compiled function defined in projectile.el.

Signature

(projectile-detect-project-type &optional DIR PROJECT-ROOT)

Documentation

Detect the type of the project.

When DIR is specified it detects its project type, otherwise it acts on the current project. PROJECT-ROOT, if provided, is used for caching instead of re-resolving via projectile-project-root(var)/projectile-project-root(fun).

Fallback to a generic project type when the type can't be determined.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260310.858/projectile.el
(defun projectile-detect-project-type (&optional dir project-root)
  "Detect the type of the project.
When DIR is specified it detects its project type, otherwise it acts
on the current project.  PROJECT-ROOT, if provided, is used for caching
instead of re-resolving via `projectile-project-root'.

Fallback to a generic project type when the type can't be determined."
  (let ((project-type
         (or (car (seq-find
                   (lambda (project-type-record)
                     (let ((project-type (car project-type-record))
                           (marker (plist-get (cdr project-type-record) 'marker-files)))
                       (if (functionp marker)
                           (and (funcall marker dir) project-type)
                         (and (projectile-verify-files marker dir) project-type))))
                   projectile-project-types))
             'generic)))
    (puthash (or project-root (projectile-project-root dir))
             project-type projectile-project-type-cache)
    project-type))