From c62d5df03646b4fc670600f64b5dd7dcee666985 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Tue, 28 Apr 2026 10:15:21 -0700 Subject: [PATCH] Include ignored files in Projectile file search --- dotfiles/emacs.d/README.org | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index a99dee7a..11491013 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -1752,6 +1752,7 @@ bind-key and global-set-key forms. ((projectile-require-project-root nil) (projectile-enable-caching nil) (projectile-git-submodule-command nil) + (projectile-git-use-fd t) (project-vc-merge-submodules nil) (projectile-current-project-on-switch 'keep)) :config @@ -1765,6 +1766,43 @@ bind-key and global-set-key forms. `(let ((default-directory ,directory)) ,@forms)) + (defvar imalison:projectile-find-ignore-file ".projectile-find-ignore" + "Project-local fd ignore file used only for Projectile file finding.") + + (defun imalison:projectile-fd-ignore-file-arg () + "Return a shell fragment that adds `imalison:projectile-find-ignore-file' when present." + (let ((ignore-file (shell-quote-argument imalison:projectile-find-ignore-file))) + (format "$(test -f %s && printf -- '--ignore-file %s')" ignore-file ignore-file))) + + (defun imalison:projectile-fd-command (&optional pattern) + "Build an fd command for Projectile file finding. +The command includes ignored and hidden files by default, then applies +`imalison:projectile-find-ignore-file' when that file exists in the project +root. PATTERN is passed as fd's search pattern when non-nil." + (mapconcat + #'identity + (delq nil + (list projectile-fd-executable + pattern + "-H" + "--no-ignore" + (imalison:projectile-fd-ignore-file-arg) + "-0" + "-E .git" + "-tf" + "--strip-cwd-prefix" + "-c never")) + " ")) + + (when projectile-fd-executable + (setq projectile-git-fd-args + (replace-regexp-in-string + (concat "^" (regexp-quote projectile-fd-executable) " ") + "" + (imalison:projectile-fd-command))) + (setq projectile-generic-command + (imalison:projectile-fd-command "."))) + (defun imalison:do-rg-default-directory (&rest args) (interactive) (let ((consult-ripgrep-args (concat consult-ripgrep-args " --no-ignore" " --hidden")))