Function: projection-project-types
projection-project-types is a natively compiled function defined in
projection-core-match.el.
Signature
(projection-project-types ROOT-DIR &optional MUST-MATCH)
Documentation
Determine all project types matching ROOT-DIR.
With MUST-MATCH an error will be raised if no project types could be matched.
Source Code
;; Defined in /nix/store/j6y921qbdmdqxjnd43iibapbig3p4hai-emacs-packages-deps/share/emacs/site-lisp/elpa/projection-20260614.1822/projection-core-match.el
(defun projection-project-types (root-dir &optional must-match)
"Determine all project types matching ROOT-DIR.
With MUST-MATCH an error will be raised if no project types could be matched."
(let ((matching-types
(or
(when-let* ((types (projection--cache-get root-dir 'types)))
(mapcar #'projection--name-to-type types))
(when-let* ((project-types (projection--match-project-types root-dir)))
(projection--cache-put root-dir 'types
(mapcar #'projection-type--name project-types))
project-types))))
;; Ensure the default project-type is the first entry in the collection
;; of matching types. This is so any functions relying on this result can
;; expect on the invariant of (car types) == default-type.
(when-let* ((default-type (projection-project-type root-dir)))
(when (and
(not (eq default-type projection-default-type))
(not (eq default-type (car matching-types))))
(setq matching-types (append (list default-type)
(delq default-type matching-types)))))
;; Ensure the locally overridden project-type is in the collection of matching
;; types. It doesn't necessarily have to be the primary type since you can
;; override it after the fact but it should always be in the list.
(when-let* ((local-primary-project-type
(when projection-primary-project-type
(projection--name-to-type projection-primary-project-type))))
(unless (member local-primary-project-type matching-types)
(setq matching-types (append (list (car matching-types)
local-primary-project-type)
(cdr matching-types)))))
(or
matching-types
(when (and must-match
(not projection-default-type))
(error "Could not determine any project types for %s" root-dir))
(list projection-default-type))))