Function: cider--ns-from-path
cider--ns-from-path is a byte-compiled function defined in
cider-client.el.
Signature
(cider--ns-from-path PATH)
Documentation
Derive a Clojure namespace from PATH using project layout heuristics.
PATH is expected to be an absolute file path inside a project (see
cider-project-dir). The first directory component of the project-
relative path is dropped (typically src or test) and any prefix
matching an entry in cider-directory-prefixes is stripped from the
result. Returns nil when PATH isn't inside a recognized project.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-client.el
(defun cider--ns-from-path (path)
"Derive a Clojure namespace from PATH using project layout heuristics.
PATH is expected to be an absolute file path inside a project (see
`cider-project-dir'). The first directory component of the project-
relative path is dropped (typically `src' or `test') and any prefix
matching an entry in `cider-directory-prefixes' is stripped from the
result. Returns nil when PATH isn't inside a recognized project."
(when-let* ((proj (cider-project-dir (file-name-directory path)))
(relative (file-relative-name path proj))
(drop-first (mapconcat #'identity
(cdr (split-string relative "/"))
"/")))
(cl-reduce (lambda (acc re) (replace-regexp-in-string re "" acc))
cider-directory-prefixes
:initial-value (cider-path-to-ns drop-first))))