projectile icon indicating copy to clipboard operation
projectile copied to clipboard

File local projectile-project-root not working correctly

Open dakra opened this issue 7 years ago • 13 comments

Run emacs -Q and load projectile.el Eval (setq-local projectile-project-root "/home/daniel/some/project/AAA") Now projectile-find-file shows files from project AAA but no eval (setq-local projectile-project-root "/home/daniel/some/project/BBB") (Or open a new file and eval it there) and you should be in project BBB but instead you're still in AAA.

My use case is that I want to link certain org files (which are all in one folder) to different projects. In each org file top I have # -*- projectile-project-root: "/home/daniel/project/A" -*- etc

Both projectile and Emacs is latest master from git running on GNU/Linux.

dakra avatar Jan 17 '18 04:01 dakra

I'll look into this when I have some, although this is so basic that I can hardly imagine how it's not working.

bbatsov avatar Jan 25 '18 10:01 bbatsov

Thanks for looking into it. Maybe I do something wrong that's why I reproduced it with emacs -Q. Just put # -*- projectile-project-root: "/home/daniel/project/A" -*- in one org file and another project in another file and then (after reloading file local vars) eval (projectile-project-root). That's my exact usecase (which I thought other people would use as well). Maybe noteworthy is that I use latest Emacs from git and the org files are in a project themselves (they're in git too).

Let me know if you need more info or if I can help somehow.

Thanks.

dakra avatar Jan 25 '18 10:01 dakra

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

stale[bot] avatar May 08 '19 18:05 stale[bot]

This bug still exists. Setting projectile-project-root via setq-local or dir/file local varsdoesn't really set the projectile root (e.g. projectile-find-file doesn't know the project).

I just didn't have time to investigate myself further why that happens. Would be great if I find a way to set the projectile root per org-file though.

dakra avatar May 09 '19 07:05 dakra

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

stale[bot] avatar Aug 07 '19 07:08 stale[bot]

Re: stale bot. The bug is still there.

dakra avatar Aug 07 '19 07:08 dakra

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

stale[bot] avatar Feb 03 '20 09:02 stale[bot]

Re: stale bot. The bug is still there.

dakra avatar Feb 03 '20 12:02 dakra

I'm experiencing the same issue, with a similar usecase. Invalidating the cache when changing to another org file helps somewhat, but it's definitely not a solution.

YoungFrog avatar Jun 04 '20 05:06 YoungFrog

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

stale[bot] avatar Jun 02 '21 17:06 stale[bot]

The bug is still there.

I think it's because projectile-project-root uses projectile-project-root-cache which is only set once for a project.

So if I have multiple buffer-local values with different project roots in my org project, on first invocation, projectile-project-root-cache gets an entry to the first project. Then switching to another org file in that project that has another buffer local project root is not working as projectile-project-root only looks at the cache.

dakra avatar Jun 02 '21 19:06 dakra

I believe this may be because of a typo on line 1132 that returns the value of the variable projectile-project-root instead of the value of projectile-root-local.

As a workaround (tested and working for me), simply set projectile-project-root in your .dir-locals.el instead of ~~projectile-root-local~~.

The fix should be as easy as returning the correct variable value, but I haven't forked and tested it.

jrpat avatar Mar 12 '22 20:03 jrpat

Setting projectile-project-root breaks my ability to switch projects, too.

trev-dev avatar Apr 26 '23 03:04 trev-dev