Function: clojure-find-ns
clojure-find-ns is a byte-compiled function defined in
clojure-mode.el.
Signature
(clojure-find-ns &optional SUPPRESS-ERRORS)
Documentation
Return the namespace of the current Clojure buffer, honor SUPPRESS-ERRORS.
Return the namespace closest to point and above it. If there are no namespaces above point, return the first one in the buffer.
If SUPPRESS-ERRORS is t, errors during ns form parsing will be swallowed, and nil will be returned instead of letting this function fail.
The results will be cached if clojure-cache-ns is set to t.
Source Code
;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure-find-ns (&optional suppress-errors)
"Return the namespace of the current Clojure buffer, honor `SUPPRESS-ERRORS'.
Return the namespace closest to point and above it. If there are
no namespaces above point, return the first one in the buffer.
If `SUPPRESS-ERRORS' is t, errors during ns form parsing will be swallowed,
and nil will be returned instead of letting this function fail.
The results will be cached if `clojure-cache-ns' is set to t."
(if (and clojure-cache-ns clojure-cached-ns)
clojure-cached-ns
(let* ((f (lambda (direction)
(if suppress-errors
(ignore-errors (clojure--find-ns-in-direction direction))
(clojure--find-ns-in-direction direction))))
(ns (save-excursion
(save-restriction
(widen)
;; Move to top-level to avoid searching from inside ns
(ignore-errors (while t (up-list nil t t)))
(or (funcall f 'backward)
(funcall f 'forward))))))
(setq clojure-cached-ns ns)
ns)))