Function: cider-xref--enclosing-libspec

cider-xref--enclosing-libspec is a byte-compiled function defined in cider-xref-source.el.

Signature

(cider-xref--enclosing-libspec POS LIMIT)

Documentation

Return the libspec vector enclosing POS as a string, or nil.

POS should sit on a namespace symbol inside an (ns ...) form; LIMIT bounds the search. Returns the text of the [...] libspec, e.g. "[my.ns :as m]".

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-xref-source.el
(defun cider-xref--enclosing-libspec (pos limit)
  "Return the libspec vector enclosing POS as a string, or nil.
POS should sit on a namespace symbol inside an `(ns ...)' form; LIMIT bounds the
search.  Returns the text of the `[...]' libspec, e.g. \"[my.ns :as m]\"."
  (save-excursion
    (goto-char pos)
    (condition-case nil
        (progn
          (backward-up-list)
          (when (eq (char-after) ?\[)
            (let ((beg (point)))
              (forward-sexp)
              (when (<= (point) limit)
                (buffer-substring-no-properties beg (point))))))
      (error nil))))