Function: projectile--ignored-path-p

projectile--ignored-path-p is a byte-compiled function defined in projectile.el.

Signature

(projectile--ignored-path-p PATH ROOT DIRECTORY-P)

Documentation

Return non-nil when PATH is ignored in the project at ROOT.

PATH is an absolute file name and DIRECTORY-P says whether it names a directory, in which case directory-only patterns (those with a trailing slash) can match it. ROOT defaults to the current project's root.

The check is the one indexing performs: PATH's root-relative name is matched against projectile--ignore-patterns, ! ensure patterns rescue it, and projectile-globally-ignored-file-regexps is applied to the absolute name. Because an ignored directory covers its whole subtree, a path inside one is reported as ignored too.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--ignored-path-p (path root directory-p)
  "Return non-nil when PATH is ignored in the project at ROOT.

PATH is an absolute file name and DIRECTORY-P says whether it names a
directory, in which case directory-only patterns (those with a trailing
slash) can match it.  ROOT defaults to the current project's root.

The check is the one indexing performs: PATH's root-relative name is
matched against `projectile--ignore-patterns', `!' ensure patterns
rescue it, and `projectile-globally-ignored-file-regexps' is applied to
the absolute name.  Because an ignored directory covers its whole
subtree, a path inside one is reported as ignored too."
  (let* ((path (expand-file-name path))
         (root (file-name-as-directory
                (expand-file-name (or root (projectile-project-root)))))
         (relative-name (projectile--project-relative-name path root))
         (relative-name (if directory-p
                            (file-name-as-directory relative-name)
                          relative-name))
         (patterns (projectile-filtering-patterns root))
         (ignore-re (projectile--compile-ignore-patterns (car patterns)))
         (ensure-re (projectile--compile-ignore-patterns (cdr patterns)))
         ;; Ignore matching is case-sensitive.
         (case-fold-search nil))
    (or (projectile--global-ignore-regexp-p path)
        (and ignore-re
             (string-match-p ignore-re relative-name)
             (not (and ensure-re (string-match-p ensure-re relative-name)))
             t))))