emacs projectile - "you are not in a project" displayed when in directory
Asked Answered
H

3

9

I've just created a new folder of javascript files.

The structure is:

.gitignore
README.md
build
node_modules
package.json
src
webpack.config.js

But when I try and find a file with C-c p f, I get a message in the status bar that states

You're not in a project

I have other projects with the same structure that work fine so I don't know what is going on.

Hardtop answered 23/1, 2016 at 5:37 Comment(0)
S
15

I think your project is indeed considered a project by projectile only if you have a .git folder in it (did you forget to git init?). I'm not seeing one in your case. You can alternatively add a .projectile file instead. Everything in that folder containing the .projectile file and all subfolders will be considered part of the same project.

Study answered 23/1, 2016 at 6:20 Comment(0)
P
2

Simply open any file in the git project using C-x C-f and then try running command C-c p f.

Opening a file in a git project will make projectile recognize the project.

Just open some file in a version-controlled (e.g. git) or a project (e.g. maven) directory that's recognized by Projectile and you're ready for action.

Priscian answered 29/12, 2018 at 15:45 Comment(0)
B
0

Disclaimer: I know this post is now old but since I encountered a similar issue today, it seems to me relevant to share my notes about it, taking care of users not too familiar with emacs lisp.


The culprit function is likely projectile-project-root.

You can try to investigate about it with

  • C-h f or (describe-function 'projectile-project-root)
  • C-h v or (describe-variable 'projectile-require-project-root)

The help screen provides a link to the elisp source code which you could step through using debug-on-entry (see info node "Debugging" in elisp)

This function uses caching so this might be somewhat uneasy, depending on your skills with emacs lisp.


Workaround:

I solved my case by moving my project to another directory, suspecting that its name starting with "test" may have caused the problem. I also removed project cache subdirs (check hidden as well).

Bjork answered 30/10, 2018 at 10:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.