Function: majutsu-workspace--root-label

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

Signature

(majutsu-workspace--root-label ROOT &optional DIRECTORY)

Documentation

Return a plain display label for workspace ROOT.

DIRECTORY is the base directory used to prefer sibling-relative roots.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-workspace.el
(defun majutsu-workspace--root-label (root &optional directory)
  "Return a plain display label for workspace ROOT.
DIRECTORY is the base directory used to prefer sibling-relative roots."
  (when root
    (let* ((base (file-name-as-directory (or directory default-directory)))
           (parent (file-name-directory (directory-file-name base)))
           (relative (and parent
                          (equal (file-remote-p root) (file-remote-p parent))
                          (ignore-errors (file-relative-name root parent)))))
      (cond
       ((and relative (not (string-prefix-p ".." relative)))
        (directory-file-name relative))
       (t
        (abbreviate-file-name (directory-file-name root)))))))