Function: treemacs-current-workspace
treemacs-current-workspace is a byte-compiled function defined in
treemacs-workspaces.el.
Signature
(treemacs-current-workspace)
Documentation
Get the current workspace.
The return value can be overridden by let-binding treemacs-override-workspace.
This will happen when using treemacs-run-in-every-buffer to make sure that
this function returns the right workspace for the iterated-over buffers.
If no workspace is assigned to the current scope the persisted workspaces will
be loaded and a workspace will be found based on the current-buffer.
This function can be used with setf.
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-workspaces.el
(defun treemacs-current-workspace ()
"Get the current workspace.
The return value can be overridden by let-binding `treemacs-override-workspace'.
This will happen when using `treemacs-run-in-every-buffer' to make sure that
this function returns the right workspace for the iterated-over buffers.
If no workspace is assigned to the current scope the persisted workspaces will
be loaded and a workspace will be found based on the `current-buffer'.
This function can be used with `setf'."
(treemacs--maybe-load-workspaces)
(or treemacs-override-workspace
(let* ((shelf (treemacs-current-scope-shelf))
(workspace (and shelf (treemacs-scope-shelf->workspace shelf))))
(or workspace
(let* ((workspace (treemacs--find-workspace (buffer-file-name (current-buffer))))
(new-shelf (treemacs-scope-shelf->create! :workspace workspace)))
(setf (treemacs-current-scope-shelf) new-shelf)
(run-hook-with-args treemacs-workspace-first-found-functions
workspace (treemacs-current-scope))
workspace)))))