Function: projectile--directory-marker
projectile--directory-marker is a byte-compiled function defined in
projectile.el.
Signature
(projectile--directory-marker DIRECTORY MARKERS &optional FILES-ONLY)
Documentation
Return the first of MARKERS present in DIRECTORY, or nil.
DIRECTORY is listed once with projectile--directory-entry-set and the
plain-name markers are answered from that listing, so probing N
candidates costs one round-trip instead of N - which matters both for
long marker lists and for remote projects. A marker carrying a path
separator or a wildcard can't be answered from a basename listing and is
probed directly. With FILES-ONLY non-nil a marker naming a directory
doesn't count as present.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--directory-marker (directory markers &optional files-only)
"Return the first of MARKERS present in DIRECTORY, or nil.
DIRECTORY is listed once with `projectile--directory-entry-set' and the
plain-name markers are answered from that listing, so probing N
candidates costs one round-trip instead of N - which matters both for
long marker lists and for remote projects. A marker carrying a path
separator or a wildcard can't be answered from a basename listing and is
probed directly. With FILES-ONLY non-nil a marker naming a directory
doesn't count as present."
(let ((entries nil) (listed nil))
(seq-find
(lambda (marker)
(cond
((not (stringp marker)) nil)
((or (string-search "/" marker) (projectile--wildcard-p marker))
(let ((expanded (projectile-expand-file-name-wildcard marker directory)))
(and (projectile-file-exists-p expanded)
(or (not files-only) (not (file-directory-p expanded))))))
(t (unless listed
(setq entries (projectile--directory-entry-set directory)
listed t))
(and entries
(gethash marker entries)
(or (not files-only)
(not (file-directory-p (expand-file-name marker directory))))))))
markers)))