Function: bazel--repository-relative-name

bazel--repository-relative-name is a natively compiled function defined in bazel.el.

Signature

(bazel--repository-relative-name FILE)

Documentation

Return FILE as relative to its Bazel repository root.

Return nil if FILE is not in a Bazel repository. If
‘non-essential’ is non-nil, avoid hitting the filesystem;
instead, look up FILE in a cache, so the results might be stale.

Source Code

;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazel--repository-relative-name (file)
  "Return FILE as relative to its Bazel repository root.
Return nil if FILE is not in a Bazel repository.  If
‘non-essential’ is non-nil, avoid hitting the filesystem;
instead, look up FILE in a cache, so the results might be stale."
  (declare (ftype (function (string) (or string null))))
  (cl-check-type file string)
  (let ((cache bazel--repository-relative-name))
    (if non-essential
        (gethash file cache)
      (puthash file
               (when-let* ((root (bazel--repository-root file)))
                 (file-relative-name file root))
               cache))))