Function: bazel--workspace-name

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

Signature

(bazel--workspace-name)

Documentation

Return the name of the workspace.

The current buffer should contain the contents of a Bazel WORKSPACE file. Look around for a “workspace” statement and return its name. See URL
‘https://bazel.build/rules/lib/globals#workspace’.

Source Code

;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazel--workspace-name ()
  "Return the name of the workspace.
The current buffer should contain the contents of a Bazel
WORKSPACE file.  Look around for a “workspace” statement and
return its name.  See URL
‘https://bazel.build/rules/lib/globals#workspace’."
  (declare (ftype (function () (or null string))))
  (save-excursion
    (goto-char (point-min))
    (cl-block nil
      (let ((case-fold-search nil)
            (search-spaces-regexp nil))
        (while (progn (forward-comment (buffer-size))
                      (re-search-forward (rx symbol-start "workspace(") nil t))
          (forward-comment (buffer-size))
          (unless (or (eobp) (python-syntax-comment-or-string-p))
            (let ((begin (point))
                  (end (progn (python-nav-end-of-statement) (point))))
              (goto-char begin)
              (while (progn (forward-comment (buffer-size))
                            (re-search-forward
                             (rx symbol-start "name" (* blank) ?= (* blank)
                                 (group (any ?\" ?\'))
                                 (group (+ (any "a-z" "A-Z" "0-9" ?_ ?- ?.)))
                                 (backref 1))
                             end t))
                (let ((name (match-string-no-properties 2)))
                  (unless (python-syntax-comment-or-string-p)
                    (cl-return name))))
              (goto-char end))))))))