Open treemacs on startup in every tab-frame (tab-bar-mode)
I've added a startup hook in order to auto-run treemacs:
(add-hook 'emacs-startup-hook 'treemacs)
This works fine when using a single tab of tab-bar-mode. For multiple tabs, however, this hook would only launch treemacs on the selected tab. For the remaining tabs treemacs has to be launched manually.
What can I do in order to run treemacs on every tab-frame?
I don't use tabs myself. Can you give me an example for a config with multiple tabs?
Sorry fo the late reply!
Please proceed as follows:
- Enable tab-bar-mode. This will allow you to switch between multiple collections of open buffers.
- Add second tab.
- Launch treemacs
- Observe, that you can switch tabs. Treemacs will be visible for both tabs. In addition it will follow by project, if you have follow-mode enabled. Nice!
- Enable desktop-mode.
- Close your emacs session. If set up, this will store the complete buffer setup, i.e. also both tabs from tab-bar-mode including the associated buffers.
- Relaunch emacs.
- Observe that treemacs was enabled on the first vvisible tab, but not on the second tab.
Is this thourough enough or do you need additional information?
Thanks!
Observe that treemacs was enabled on the first vvisible tab, but not on the second tab.
Thanks to treemacs' scoping mechanism restoring treemacs with desktop-mode is not as simple as popping up a new buffer. I have to wait until all scopes, be it frames or tabs, are restored and then assign them their individual treemacs buffers. The problem is that buffers are loaded before frames are (and probably tabs as well). Working around that would be a hack, adding in lazy desktop restoration and it turns into just pain.
The point is: treemacs should not be enabled in any tab. It is explicitly set up to not be saved by desktop-mode. The expected behavior is that you need to call treemacs manually after your tabs are restored or add its start to your config.
OK, thanks for the thourough explanation! Once I got used to the behavior, it's not really an issue anymore. Instead tab-bar, treemacs as well as desktop mode integrate pretty well.
IMO we can therefore close the issue. Thanks!
This issue has been automatically marked as stale because it has not had recent activity.