Function: projection--project-matches-p

projection--project-matches-p is a natively compiled function defined in projection-core-match.el.

Signature

(projection--project-matches-p ROOT-DIR PROJECT-TYPE)

Documentation

Assert whether project of type PROJECT-TYPE matches ROOT-DIR.

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-matches-p (root-dir project-type)
  "Assert whether project of type PROJECT-TYPE matches ROOT-DIR."
  (let ((default-directory root-dir))
    (if-let* ((predicate (oref project-type predicate)))
        (progn
          (setq predicate
                (if (and (consp predicate)
                         (functionp predicate))
                    (list predicate)
                  ;; For some reason this can't handle closures accurately.
                  (ensure-list predicate)))
          (cl-loop for it in predicate
                   when (cond
                         ((stringp it)
                          (file-exists-p it))
                         ((functionp it)
                          (funcall it))
                         (t
                          (user-error "Unknown project predicate type %s: %S"
                                      (projection-type--name project-type)
                                      it)))
                   return t
                   finally return nil))
      (warn "Project with no predicate in `projection-project-types': %s"
            (projection-type--name project-type)))))