Function: projectile--grep-rebase-paths

projectile--grep-rebase-paths is a byte-compiled function defined in projectile.el.

Signature

(projectile--grep-rebase-paths PATHS PROJECT-ROOT ROOT-DIR)

Documentation

Respell root-anchored PATHS relative to ROOT-DIR.

PATHS are relative to PROJECT-ROOT, while find is started in ROOT-DIR - either the project root itself or one of the dirconfig + keep subdirectories. A path that doesn't live under ROOT-DIR can't match anything the search will see, so it is dropped.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--grep-rebase-paths (paths project-root root-dir)
  "Respell root-anchored PATHS relative to ROOT-DIR.
PATHS are relative to PROJECT-ROOT, while `find' is started in ROOT-DIR -
either the project root itself or one of the dirconfig `+' keep
subdirectories.  A path that doesn't live under ROOT-DIR can't match
anything the search will see, so it is dropped."
  (let ((prefix (file-relative-name
                 (file-name-as-directory (expand-file-name root-dir))
                 (file-name-as-directory (expand-file-name project-root)))))
    (if (member prefix '("./" "" "."))
        paths
      (delq nil (mapcar (lambda (path)
                          (and (string-prefix-p prefix path)
                               (substring path (length prefix))))
                        paths)))))