Is it possible to have a separate Treemacs "instance" per layout. I say "instance" because I am not sure of the precise terminology to use.
It may help to describe my use-case. I often work on several different inter-related projects and I use a combination of projectile along with layouts (which may be a Spacemacs concept) to accomplish this. I want to have one layout per project and when I have a specific layout (which is tied to one projectile project) I want to have only that single treemacs root open, and then when I switch to another layout (with it's associated projectile project) I want only that project's treemacs root to be open.
Does that make sense? Is there a way to get that behavior working in the current version of Treemacs?
Potentially related to: https://github.com/Alexander-Miller/treemacs/issues/176
As of now treemacs buffers are localized to frames. I can try expanding that system to use layouts instead. It might be easy, it might be a compatibility nightmare, I can really see it go either way.
I'll put this on my todo list, but for now I'm concentrating on going through my issues oldest-first.
Okay that makes sense. I'll try to get used to multi-root in the meantime.
What would be neat is if Treemacs workspaces could be synced with layouts. So each layout would get its own workspace in Treemacs. And switching layout would switch to its workspace.
Now I kind of manually do it, where I'll create a workspace for each of my layout, but I have to manually create a workspace and switch to it as I create/switch layouts.
Does you layout package offer hooks for switching? That would make things a lot easier and require only minimal additions on my part.
The groundwork for a generalized scope framework has been laid and pushed. If nothing breaks I'll continue work to introduce a new scope type next to the default frame option.
What option do you want to see, persp, eyebrowse, something else?
Not sure if you're asking me or @didibus but I'm not sure how to answer that since I don't believe I use any of those (mainly just projectile)
Not sure if you're asking me or @didibus
Yes. The question goes to anyone who is interested in this feature.
Hum... I would hope for supporting the one Spacemacs uses: https://github.com/syl20bnr/spacemacs/blob/develop/doc/DOCUMENTATION.org#layouts-and-workspaces
Not sure which one that is.
persp it is then.
I do not use persp-mode and I don't know what a typical workflow with it looks like, so for the next step I will need help testing my implementation. All you need to do is grab the latest treemacs (addon packages need to be updated as well), load the persp module manually and then tell me when something goes wrong.
Forgot to mention: scope type can be changed with treemacs-select-buffer-scope.
Hum... I'm not sure I understand how to make use of it. I loaded treemacs-persp, and required it. And I switched buffer scope to Perspectives.
Then I create two perspectives, and in treemacs try to set different projects, but as I switch perspective, it seems to continue to be showing the same set of projects in treemacs.
Okay, I needed to create a treemacs workspace for each perspective, and then in each perspective switch to that treemacs workspace. Now as I switch perspective it switches between treemacs workspaces as well.
One thing that would be nice is if it could automatically create a treemacs workspace of the same name as the perspective when I create a new perspective and switch to it. So I don't have to manually do it every time I create a new perspective.
Another thing is, if I save and restore my perspective? I'm guessing the treemacs workspaces don't get saved and restored. I couldn't really test that, since I am currently manually loading treemacs-persp, but I'm not seeing anything in the code which would. I guess currently you can't even persist treemacs workspace? So maybe this would need to happen first?
Okay, I needed to create a treemacs workspace for each perspective,
Basically yes, otherwise you'll just have multiple treemacs buffer showing the same workspace.
automatically create a treemacs workspace of the same name as the perspective when I create a new perspective and switch to it
Non-trivial stuff. I'll open a new ticket for it.
I guess currently you can't even persist treemacs workspace?
You most certainly can. Everything you created should still be there when you call treemacs-edit-workspaces. Treemacs selects a workspace by finding the first on with a project that contains the current buffer's file and falls back to the first in the list. I guess that's what you are seeing. That kind of mapping restoration never worked right with frames, but it should be doable with perspectives. I'll open a new ticket as well.
Sweet! By the way, love treemacs! Appreciate all your work.
treemacs-persp is now on melpa, so we can close here.
Hi there!
Thanks for your work on treemacs! It seems the issue was solved. I am on Spacemacs and still have the exact same problem as @axelson. Not sure I understand how to make use of your patches in the context of Spacemacs & projectile... If anyone has time, could you provide some guidance?
@NicoGim If you can follow through the conversation here https://github.com/Alexander-Miller/treemacs/issues/592, you should, hopefully, find the solution at the end of the thread.
That ticket is due for a close. I'll put patching spacemacs on my todo list.
@nicobao Spacemacs has now been updated, the treemacs layer docs will tell you what you need to do.
Thanks all! It's awesome. For anyone passing by that cannot figure out relevant info in the docs, try SPC p t :).
Most helpful comment
persp it is then.