I am trying out exercism.io and whenever I fetch any problem and build, it gets added to projectile-known-projects and now I've a whole bunch of projects under projectile-known-projects which I do not want.

So, is there a way to ignore all the git projects under a directory, in my case ~/exercism/ directory.

I tried adding ~/exercism/ to projectile-ignored-projects but that did not work(looks like it expects only the path to an actual project directory not a non-project directory which contains projects inside it)


You can customize projectile-ignored-project-function to specify a custom function that gets called when projectile is about to add a project to the known projects list.

For example, here is a how you might tell projectile to ignore any projects under foo. (This uses the f library for convenience. If you don't want to install another package you can use string functions or some other mechanism to decide if the given project root should be ignored.)

(with-eval-after-load 'projectile
  (require 'f)
  (defun my-projectile-ignore-project (project-root)
    (f-descendant-of? project-root (expand-file-name "/foo")))
  (setq projectile-ignored-project-function #'my-projectile-ignore-project))

If you only want to ignore git projects you can add additional checks to the my-projectile-ignore-project function, such as checking for a .git subdirectory: (and ... (file-exists-p (expand-file-name ".git" project-root)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.