Function: treemacs-switch-workspace

treemacs-switch-workspace is an interactive and byte-compiled function defined in treemacs-interface.el.

Signature

(treemacs-switch-workspace ARG)

Documentation

Select a different workspace for treemacs.

With a prefix ARG clean up buffers after the switch. A single prefix argument will delete all file visiting buffers, 2 prefix arguments will clean up all open buffers (except for treemacs itself and the scratch and messages buffers).

Without a prefix argument treemacs-workspace-switch-cleanup will be followed instead.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-interface.el
(defun treemacs-switch-workspace (arg)
  "Select a different workspace for treemacs.

With a prefix ARG clean up buffers after the switch.  A single prefix argument
will delete all file visiting buffers, 2 prefix arguments will clean up all open
buffers (except for treemacs itself and the scratch and messages buffers).

Without a prefix argument `treemacs-workspace-switch-cleanup' will
be followed instead."
  (interactive "P")
  (pcase (treemacs-do-switch-workspace)
    ('only-one-workspace
     (treemacs-pulse-on-failure "There are no other workspaces to select."))
    (`(success ,workspace)
     (treemacs--maybe-clean-buffers-on-workspace-switch
      (pcase arg
        (`(4) 'files)
        (`(16) 'all)
        (_ treemacs-workspace-switch-cleanup)))
     (treemacs-pulse-on-success "Selected workspace %s."
       (propertize (treemacs-workspace->name workspace))))))