Given a project directory my-project which projectile correctly identifies because it is a git project.

Inside my-project there is a my-module directory. It is a git submodule and therefor projectile identifies it as a project of it's own.

But I want all files inside of my-project/my-module to be considered as part of my-project.

What is the idiomatic way to configure this?

I would like a solution in dir-locals.el so it does not affect other projects.

  • Please don't post the same question in StackOverflow and emacs.SE. Choose one to keep and please delete the other. Thx.
    – Drew
    Oct 18 '21 at 15:02
  • You can try counsel-fd if your goal is to just browse subdirectories and files within my-project. Oct 21 '21 at 2:23

See the issues: https://github.com/bbatsov/projectile/issues/712 / https://github.com/bbatsov/projectile/issues/1449.

One of the options suggested there is to (edit: I've changed projectile-project-root-files-functions -> projectile-project-root-functions which it was aliased to):

(setq projectile-project-root-functions '(projectile-root-local

Edit: I see you want this to not to affect other projects so you'd want to put this in .dir-locals.el in the project root.

  • This had no effect at all. Opening a file from the sub project and running projectile-project-info identifies the sub project as the project.
    – Witek
    Oct 20 '21 at 19:55
  • Have you tried updating projectile, and removing .projectile or .dir-locals vars which could be setting the project root? If you'd be open to sharing the project link, I could clone and see if I can reproduce what you're seeing. Oct 21 '21 at 10:13
  • I think moving the .dir-locals.el file you mention you have from the submodule root to the project root should also work. Oct 21 '21 at 10:49
  • I have reinstalled doom emacs configuration and it works now.
    – Witek
    Oct 21 '21 at 19:09

The solution was putting this into my-project/my-module/.dir-locals.el:

((nil . ((projectile-project-root . "/p/my-project/"))))

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.