Function: cider-expected-ns

cider-expected-ns is a byte-compiled function defined in cider-client.el.

Signature

(cider-expected-ns &optional PATH)

Documentation

Return the namespace string matching PATH, or nil if not found.

If PATH is nil, use the path to the file backing the current buffer. The command falls back to clojure-expected-ns in the absence of an active nREPL connection.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-client.el
(defun cider-expected-ns (&optional path)
  "Return the namespace string matching PATH, or nil if not found.
If PATH is nil, use the path to the file backing the current buffer.  The
command falls back to `clojure-expected-ns' in the absence of an active
nREPL connection."
  (if (cider-connected-p)
      (let* ((path (file-truename (or path buffer-file-name)))
             (relpath (thread-last
                        (cider-classpath-entries)
                        (seq-filter #'file-directory-p)
                        (seq-map (lambda (dir)
                                   (when (file-in-directory-p path dir)
                                     (file-relative-name path dir))))
                        (seq-filter #'identity)
                        (seq-sort (lambda (a b)
                                    (< (length a) (length b))))
                        (car))))
        (if relpath
            (cider-path-to-ns relpath)
          (clojure-expected-ns path)))
    (clojure-expected-ns path)))