Function: bazelrc-ffap

bazelrc-ffap is a natively compiled function defined in bazel.el.

Signature

(bazelrc-ffap NAME)

Documentation

Function for ‘ffap-alist’ in ‘bazelrc-mode’.

Look for an imported file with the given NAME.

Source Code

;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazelrc-ffap (name)
  "Function for ‘ffap-alist’ in ‘bazelrc-mode’.
Look for an imported file with the given NAME."
  (declare (ftype (function (string) (or string null))))
  (cl-check-type name string)
  ;; https://bazel.build/run/bazelrc#imports
  (let ((case-fold-search nil)
        (search-spaces-regexp nil))
    (pcase name
      ((rx bos "%workspace%" (+ ?/) (let rest (+ nonl)))
       (when-let* ((source-file buffer-file-name)
                   (repository (bazel--repository-root source-file)))
         (let ((file-name (expand-file-name rest repository)))
           (and (file-exists-p file-name) file-name)))))))