Function: majutsu-toplevel
majutsu-toplevel is a natively compiled function defined in
majutsu-jj.el.
Signature
(majutsu-toplevel &optional DIRECTORY)
Documentation
Return the workspace root for DIRECTORY or default-directory.
This runs jj workspace root and returns a directory name (with a
trailing slash) or nil if not inside a JJ workspace.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-jj.el
(defun majutsu-toplevel (&optional directory)
"Return the workspace root for DIRECTORY or `default-directory'.
This runs `jj workspace root' and returns a directory name (with a
trailing slash) or nil if not inside a JJ workspace."
(majutsu--with-safe-default-directory directory
(majutsu--with-no-color
(with-temp-buffer
(let ((coding-system-for-read 'utf-8-unix)
(coding-system-for-write 'utf-8-unix)
(exit (majutsu-process-jj t "workspace" "root")))
(when (zerop exit)
(let ((out (string-trim (buffer-string))))
(unless (string-empty-p out)
(majutsu-jj-expand-directory-from-jj out default-directory)))))))))