Function: majutsu-workspace--read-root

majutsu-workspace--read-root is a natively compiled function defined in majutsu-workspace.el.

Signature

(majutsu-workspace--read-root NAME &optional ROOT)

Documentation

Return the workspace root directory for NAME.

Prefer a structured :root value from the current workspace section when available. Otherwise use jj workspace root --name to resolve the path. If that fails (e.g. workspace created before jj v0.38.0), try a sibling directory of ROOT whose name matches NAME. Falls back to prompting the user.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-workspace.el
(defun majutsu-workspace--read-root (name &optional root)
  "Return the workspace root directory for NAME.

Prefer a structured `:root' value from the current workspace section when
available. Otherwise use `jj workspace root --name' to resolve the path. If
that fails \(e.g. workspace created before jj v0.38.0), try a sibling
directory of ROOT whose name matches NAME. Falls back to prompting the user."
  (let* ((root (file-name-as-directory (or root default-directory)))
         (entry (majutsu-workspace--section-entry))
         (completion-entry (majutsu-workspace--completion-context-entry name))
         (dir (or (and entry
                       (equal (plist-get entry :name) name)
                       (plist-get entry :root))
                  (plist-get completion-entry :root)
                  (majutsu-workspace--root-for-name name)
                  (majutsu-workspace--sibling-root name root)
                  (read-directory-name (format "Workspace root for %s: " name)
                                       (file-name-directory (directory-file-name root))
                                       nil t))))
    (file-name-as-directory dir)))