mclear-tools / tabspaces

GNU General Public License v3.0
226 stars 14 forks source link

tabspaces-switch-or-create doesn't create empty workspace #52

Closed omarbassam88 closed 7 months ago

omarbassam88 commented 7 months ago

The command tab-switch-or-create adds the current buffers to the the new workspace when creating a new workspace. I expect it to create a new workspace with no buffers attached to it or maybe it should be a separate command like tabspaces-create-empty-workspace.?

mclearc commented 7 months ago

Is your version of tabspaces updated to the most recent? I'm not seeing this problem. By default the scratch buffer is included in all new tabspaces. You can change this by altering tabspaces-include-buffers.

omarbassam88 commented 7 months ago

The package version is 20231222.1829. How do I upgrade to the latest version without using straight?

mclearc commented 7 months ago

You have the most recent version. Can you post your setup for it ?__Colin McLearcolinmclear.netOn Jan 24, 2024, at 9:36 AM, Omar Bassam @.***> wrote: The package version is 20231222.1829. How do I upgrade to the latest version without using straight?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

omarbassam88 commented 7 months ago
(use-package tabspaces
  :ensure t
  :init
  (tabspaces-mode t)
  :config
  (map-leader
    "TAB" '(:keymap tabspaces-command-map :wk "workspace")
    "TAB a" #'o/tabspaces-switch))

I have added a helper function to remove buffers when creating a new workspace

(defun o/tabspaces-switch (&optional workspace)
  (interactive
    (list (completing-read "Workspace: " (tabspaces--list-tabspaces))))
  (let ((new-workspacep (not (member workspace (tabspaces--list-tabspaces)))))
    (tabspaces-switch-or-create-workspace workspace)
    (when new-workspacep
      (dolist (buf (tabspaces--buffer-list))
        (tabspaces-remove-selected-buffer buf)))))
mclearc commented 7 months ago

I think your problem is that you haven't set tabspaces-use-filtered-buffers-as-default to t. If you don't do that then calling switch-to-buffer won't exclude buffers in other tabspaces (you would need to call tabspaces-switch-to-buffer if you don't want to change the default).

mclearc commented 7 months ago

look at the setup in the example: https://github.com/mclear-tools/tabspaces#setup

omarbassam88 commented 7 months ago

Yeah, That was it. Thank you.