Closed Gradecak closed 1 year ago
Me too.
I've pushed a patch to prevent following into the home directory. Does that cover your bases?
I've just tested the change and unfortunately it doesn't solve the issue I'm experiencing. Upon reading back over my original issue description I think I may have done a poor job communicating the problem.
From what I can tell, the issue is not related to the home directory. Rather, if you follow into any directory which itself contains project directories treemacs will no longer follow to the root of the children projects.
For example consider the following structure ~/projects ~/projects/A/ ~/projects/B/ ~/projects/some-document.txt
If at any point I'm looking at some-document.txt
and open treemacs. ~/projects/
is now set as the workspace path. Opening treemacs while in projects A
or B
will no longer update the workspace path to ~/projects/A/
since ~/projects/A/
is contained within ~/projects
But rather it will display the entire contents of ~/projects
.
Treemacs doesn't determine the current project on its own. It'll first ask projectile (if installed), then the builtin project.el, then it'll fall back on the current directory.
Based on a short test projectile will pick what you want if you place a .projectile
file in your sub-project, so you can try that.
This issue has been automatically marked as stale because it has not had recent activity.
I'm having the same issue.
To reproduce this issue:
I have both project treemacs-follow-mode and treemacs-project-follow-mode set to t.
Edit the .emacs (or .spacemacs or whatever) in your user home directory.
Run treemacs-find-file or treemacs-select-window -- this exposes the whole user directory in the treemacs window.
Close treemacs and delete the current file buffer.
Open a file in another project.
Run treemacs-find-file or treemacs-select-window -- this display the current file, however the rest of the user root is showing as well. The project focus is broken. It's now viewing the file as still in the current project of the user root folder.
Running treemacs-display-current-project-exclusively -- still doesn't work in this scenario.
Perhaps this is user error, but I'd prefer to have treemacs open and stop at the current projects's root every time it's called. If treemacs is displayed in the user's root, it is now active for any projects tucked inside the user root until emacs is completely closed and reopened.
Is there a command to wipe the treemacs project root pointer? Perhaps I just need to run a lambda function that does that and then runs treemacs-display-current-project-exclusively?
Nevermind... It's treemacs-narrow-to-current-file that I'm looking for. I suppose I expected this to be native functionality on opening treemacs with any command when treemacs-follow-mode is selected -- not a separate feature.
I've come back to treemacs after some time and this issue appears to be fixed for me. Not exactly sure what changed, but it now works as I expect. With this in mind I'll close this issue.
Thank you very much for the help!
Hi All,
I'm trying to set up treemacs without to concept of workspaces and for it to only ever follow the current project (using Projectile to determine the current project root).
I've enabled
treemacs-project-follow-mode
and usetreemacs-display-current-project-exclusively
which does initially work, and I have the behaviour I want. Treemacs always displays the current project root as the root of the tree.However, I've encountered an issue that if I ever open treemacs in a buffer that is associated with my home directory, Treemacs will no longer update the root of the tree to the root of the project that is opened. Instead, it will always show the home directory as the root.
This behaviour will persist until I use
treemacs-edit-workspaces
to change the path to be something other than~/
at which point treemacs will once again correctly follow my projects.From the outside this appears to be a bug, but admittedly I'm not extremely familiar with treemacs configuration and its entirely possible that I've missed a crucial piece of configuration. For reference this is my config