Bad-ptr / persp-mode.el

named perspectives(set of buffers/window configs) for emacs
394 stars 44 forks source link

[feature-request] Tab-bar-mode integration #122

Open CsBigDataHub opened 3 years ago

CsBigDataHub commented 3 years ago

allow keeping a distinct set of tabs per-perspective.

from README of https://github.com/nex3/perspective-el

Tab Bar maintains window layouts (with optional names). In this, it is similar to Perspective. Unlike Perspective, it does not support buffer lists. Using Perspective and Tab Bar at the same time is not recommended at this time, since the tab list is global (i.e., will show up in all perspectives) and is likely to cause confusion. It would be an interesting future feature for ?Perspective to adopt the tab bar and allow keeping a distinct set of tabs per-perspective.

Opening a issue similar to https://github.com/nex3/perspective-el/issues/138

LemonBreezes commented 1 year ago
  (add-hook 'persp-before-deactivate-functions
            (defun +workspaces-save-tab-bar-data-h (_)
              (when (get-current-persp)
                (set-persp-parameter
                 'tab-bar-tabs (tab-bar-tabs)))))

  (add-hook 'persp-activated-functions
            (defun +workspaces-load-tab-bar-data-h (_)
              (tab-bar-tabs-set (persp-parameter 'tab-bar-tabs))
              (tab-bar--update-tab-bar-lines t))))

This snippet has been working for me.

roife commented 1 year ago

The snippet saves the configuration of tab-bar to files:

(add-hook 'persp-before-save-state-to-file-functions
              (defun +workspaces-save-tab-bar-data-to-file-h (&rest _)
                (when (get-current-persp)
                  (set-persp-parameter 'tab-bar-tabs (frameset-filter-tabs (tab-bar-tabs) nil nil t))