@@ -226,6 +226,12 @@ Inherits from `emacs-lisp-mode-syntax-table'.")
226
226
(defconst clojure--prettify-symbols-alist
227
227
'((" fn" . ?λ )))
228
228
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
+
229
235
(defun clojure-mode-display-version ()
230
236
" Display the current `clojure-mode-version' in the minibuffer."
231
237
(interactive )
@@ -318,6 +324,7 @@ instead of to `clojure-mode-map'."
318
324
(setq-local indent-region-function #'clojure-indent-region )
319
325
(setq-local lisp-indent-function #'clojure-indent-function )
320
326
(setq-local lisp-doc-string-elt-property 'clojure-doc-string-elt )
327
+ (setq-local clojure-expected-ns-function #'clojure-expected-ns )
321
328
(setq-local parse-sexp-ignore-comments t )
322
329
(setq-local prettify-symbols-alist clojure--prettify-symbols-alist)
323
330
(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."
1370
1377
(defun clojure-insert-ns-form-at-point ()
1371
1378
" Insert a namespace form at point."
1372
1379
(interactive )
1373
- (insert (format " (ns %s ) " (clojure-expected-ns))))
1380
+ (insert (format " (ns %s ) " (funcall clojure-expected-ns-function ))))
1374
1381
1375
1382
(defun clojure-insert-ns-form ()
1376
1383
" 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."
1383
1390
" Update the namespace of the current buffer.
1384
1391
Useful if a file has been renamed."
1385
1392
(interactive )
1386
- (let ((nsname (clojure-expected-ns)))
1393
+ (let ((nsname (funcall clojure-expected-ns-function )))
1387
1394
(when nsname
1388
1395
(save-excursion
1389
1396
(save-match-data
0 commit comments