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.
When an nREPL connection is active, the namespace is preferentially
derived from the connection's classpath entries. Otherwise (or when
PATH isn't on the classpath) it falls back to cider--ns-from-path,
which uses project layout heuristics.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/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.
When an nREPL connection is active, the namespace is preferentially
derived from the connection's classpath entries. Otherwise (or when
PATH isn't on the classpath) it falls back to `cider--ns-from-path',
which uses project layout heuristics."
(when-let* ((path (file-truename (or path buffer-file-name))))
(if (cider-connected-p)
(let ((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)
(cider--ns-from-path path)))
(cider--ns-from-path path))))