projectile
projectile copied to clipboard
File local projectile-project-root not working correctly
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.
I'll look into this when I have some, although this is so basic that I can hardly imagine how it's not working.
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.
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!
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.
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!
Re: stale bot. The bug is still there.
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!
Re: stale bot. The bug is still there.
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.
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!
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.
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.
Setting projectile-project-root breaks my ability to switch projects, too.