How to force emacs projectile to reinitialize a project?
Asked Answered
I

2

11

I'm using projectile with emacs to manage a large project.

I moved a number of directories with scores of files.

The old file paths are still showing up in projectile find file (C-c p f).

How do I remove them in bulk or force projectile to re-initialize the project?

I've tried:

  • projectile-purge-dir-from-cache
  • projectile-invalidate-cache
  • quitting emacs, deleting ~/.emacs.d/projectile.cache, restarting emacs
  • adding a .projectile file with 'exclude' options for the original dirs

After all of these, the same original list of old paths/files still appears on C-c p f.

Incandescence answered 16/11, 2016 at 3:17 Comment(2)
How about deleting ~/.emacs.d/projectile.cache and using either ag(the silver searcher) or rg (ripgrep) to generate the project files ? Check out my projectile config to get an idea on how you can use rg to generate project filesGuimar
Have you tried C-u C-c p f?Juncaceous
I
13

C-u C-c p f does it.

Thanks to Daimrod!

Incandescence answered 6/12, 2016 at 19:38 Comment(5)
What is the name of the command this keybinding is pointing to?Abbey
@Abbey the command C-c p f is projectile-find-file the C-u command says to run projectile-find-file with a different behavior. In this case the new behavior is to clear the cache first. If you read the documentation C-h o projectile-find-file you will see (projectile-find-file &optional INVALIDATE-CACHE). The C-u activates the "optional" argument.Terrilyn
@RickyNelson in my emacs (doom) I have that C-u scrolls up, so I am not sure what should substitute this.Abbey
@Abbey Should be SPC uMadsen
@Abbey I get the message: SPC u is undefined. In my evil emacs, I go to insert-mode and then press C-u. That worksIcon
Q
7

As answered here, you can simply call projectile-invalidate-cache to clear the old cache files for the current project.

This is SPC-p-i in Doom Emacs or M-x projectile-invalidate-cache in regular Emacs.

Questionless answered 18/12, 2022 at 8:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.