Function: treemacs-do-create-workspace
treemacs-do-create-workspace is a byte-compiled function defined in
treemacs-workspaces.el.
Signature
(treemacs-do-create-workspace &optional NAME)
Documentation
Create a new workspace with optional NAME.
Return values may be as follows:
* If a workspace for the given name already exists:
- the symbol duplicate-name
- the workspace with the duplicate name
* If the given name is invalid:
- the symbol invalid-name
- the name
* If everything went well:
- the symbol success
- the created workspace
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-workspaces.el
(defun treemacs-do-create-workspace (&optional name)
"Create a new workspace with optional NAME.
Return values may be as follows:
* If a workspace for the given name already exists:
- the symbol `duplicate-name'
- the workspace with the duplicate name
* If the given name is invalid:
- the symbol `invalid-name'
- the name
* If everything went well:
- the symbol `success'
- the created workspace"
(treemacs-block
(-let [name (or name (treemacs--read-string "Workspace name: "))]
(treemacs-return-if (treemacs--is-name-invalid? name)
`(invalid-name ,name))
(-when-let (ws (--first (string= name (treemacs-workspace->name it))
treemacs--workspaces))
(treemacs-return `(duplicate-name ,ws)))
(-let [workspace (treemacs-workspace->create! :name name)]
(add-to-list 'treemacs--workspaces workspace :append)
(treemacs--persist)
(run-hook-with-args 'treemacs-create-workspace-functions workspace)
`(success ,workspace)))))