treemacs icon indicating copy to clipboard operation
treemacs copied to clipboard

Open treemacs on startup in every tab-frame (tab-bar-mode)

Open darim1 opened this issue 4 years ago • 5 comments

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?

darim1 avatar Mar 13 '22 22:03 darim1

I don't use tabs myself. Can you give me an example for a config with multiple tabs?

Alexander-Miller avatar Apr 29 '22 09:04 Alexander-Miller

Sorry fo the late reply!

Please proceed as follows:

  1. Enable tab-bar-mode. This will allow you to switch between multiple collections of open buffers.
  2. Add second tab.
  3. Launch treemacs
  4. 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!
  5. Enable desktop-mode.
  6. 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.
  7. Relaunch emacs.
  8. 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!

darim1 avatar May 09 '22 11:05 darim1

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.

Alexander-Miller avatar May 09 '22 19:05 Alexander-Miller

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!

darim1 avatar May 09 '22 20:05 darim1

This issue has been automatically marked as stale because it has not had recent activity.

stale[bot] avatar Jul 09 '22 04:07 stale[bot]