9

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.

Serenade
  • 309
  • 1
  • 4
  • 12
  • 1
    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](https://github.com/CSRaghunandan/.emacs.d/blob/master/setup-files/setup-projectile.el) to get an idea on how you can use `rg` to generate project files – Chakravarthy Raghunandan Nov 18 '16 at 18:17
  • 2
    Have you tried `C-u C-c p f`? – Daimrod Nov 22 '16 at 15:38

2 Answers2

11

C-u C-c p f does it.

Thanks to Daimrod!

Serenade
  • 309
  • 1
  • 4
  • 12
  • What is the name of the command this keybinding is pointing to? – bobsacameno Jul 01 '21 at 06:52
  • @bobsacameno 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. – Ricky Nelson Jul 21 '21 at 18:22
  • 1
    @RickyNelson in my emacs (doom) I have that `C-u` scrolls up, so I am not sure what should substitute this. – bobsacameno Nov 24 '21 at 08:12
  • 2
    @bobsacameno Should be `SPC u` – Justin Wood Jan 19 '22 at 02:38
2

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.

Evidlo
  • 173
  • 1
  • 8