Function: eca-workspaces--read-workspace

eca-workspaces--read-workspace is a natively compiled function defined in eca-workspaces.el.

Signature

(eca-workspaces--read-workspace)

Documentation

Read a workspace, returning its session or its root directory.

Completion lists the running workspaces, defaulting to the one at point, and requires no match: any other input is taken as the directory of a workspace to start.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-workspaces.el
(defun eca-workspaces--read-workspace ()
  "Read a workspace, returning its session or its root directory.
Completion lists the running workspaces, defaulting to the one at
point, and requires no match: any other input is taken as the
directory of a workspace to start."
  (let* ((candidates (eca-workspaces--workspace-candidates))
         (labels (append (-map #'car candidates)
                         (list eca-workspaces--other-directory)))
         (choice (completing-read
                  "Workspace: "
                  (lambda (string pred action)
                    (if (eq action 'metadata)
                        '(metadata (category . eca-workspace)
                                   (display-sort-function . identity))
                      (complete-with-action action labels string pred)))
                  nil nil nil nil (car labels))))
    (if (equal choice eca-workspaces--other-directory)
        (eca-workspaces--workspace-directory
         (read-directory-name "Workspace directory: " nil nil t))
      (if-let* ((match (assoc choice candidates)))
          (cdr match)
        (eca-workspaces--workspace-directory choice)))))