@@ -226,6 +226,12 @@ Inherits from `emacs-lisp-mode-syntax-table'.")
226226(defconst clojure--prettify-symbols-alist
227227 '((" fn" . ?λ )))
228228
229+ (defvar-local clojure-expected-ns-function nil
230+ " The function used to determine the expected namespace of a file.
231+ `clojure-mode' ships a basic function named `clojure-expected-ns'
232+ that does basic heuristics to figure this out.
233+ CIDER provides a more complex version which does classpath analysis." )
234+
229235(defun clojure-mode-display-version ()
230236 " Display the current `clojure-mode-version' in the minibuffer."
231237 (interactive )
@@ -318,6 +324,7 @@ instead of to `clojure-mode-map'."
318324 (setq-local indent-region-function #'clojure-indent-region )
319325 (setq-local lisp-indent-function #'clojure-indent-function )
320326 (setq-local lisp-doc-string-elt-property 'clojure-doc-string-elt )
327+ (setq-local clojure-expected-ns-function #'clojure-expected-ns )
321328 (setq-local parse-sexp-ignore-comments t )
322329 (setq-local prettify-symbols-alist clojure--prettify-symbols-alist)
323330 (setq-local open-paren-in-column-0-is-defun-start nil ))
@@ -1370,7 +1377,7 @@ If PATH is nil, use the path to the file backing the current buffer."
13701377(defun clojure-insert-ns-form-at-point ()
13711378 " Insert a namespace form at point."
13721379 (interactive )
1373- (insert (format " (ns %s ) " (clojure-expected-ns))))
1380+ (insert (format " (ns %s ) " (funcall clojure-expected-ns-function ))))
13741381
13751382(defun clojure-insert-ns-form ()
13761383 " Insert a namespace form at the beginning of the buffer."
@@ -1383,7 +1390,7 @@ If PATH is nil, use the path to the file backing the current buffer."
13831390 " Update the namespace of the current buffer.
13841391Useful if a file has been renamed."
13851392 (interactive )
1386- (let ((nsname (clojure-expected-ns)))
1393+ (let ((nsname (funcall clojure-expected-ns-function )))
13871394 (when nsname
13881395 (save-excursion
13891396 (save-match-data
0 commit comments