Function: projectile-remove-ignored

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

Signature

(projectile-remove-ignored FILES)

Documentation

Remove ignored files and folders from FILES.

If ignored directory prefixed with '*', then ignore all directories/subdirectories with matching filename, otherwise operates relative to project root.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260310.858/projectile.el
(defun projectile-remove-ignored (files)
  "Remove ignored files and folders from FILES.

If ignored directory prefixed with '*', then ignore all
directories/subdirectories with matching filename,
otherwise operates relative to project root."
  (let ((ignored-files (projectile-ignored-files-rel))
        (ignored-dirs (projectile-ignored-directories-rel)))
    (seq-remove
     (lambda (file)
       (or (seq-some
            (lambda (f)
              (string= f (file-name-nondirectory file)))
            ignored-files)
           (seq-some
            (lambda (dir)
              ;; if the directory is prefixed with '*' then ignore all directories matching that name
              (if (string-prefix-p "*" dir)
                  ;; remove '*' and trailing slash from ignored directory name
                  (let ((d (string-remove-suffix "/" (substring dir 1))))
                    (seq-some
                     (lambda (p)
                       (string= d p))
                     ;; split path by '/', remove empty strings, and check if any subdirs match name 'd'
                     (delete "" (split-string (or (file-name-directory file) "") "/"))))
                (string-prefix-p dir file)))
            ignored-dirs)
           (seq-some
            (lambda (suf)
              (string-suffix-p suf file t))
            projectile-globally-ignored-file-suffixes)))
     files)))