@@ -256,7 +256,7 @@ ENDPOINT is a plist as returned by `nrepl-connect'."
256
256
(current-buffer ))))
257
257
258
258
(declare-function cider-set-buffer-ns " cider-mode" )
259
- (defun cider-repl-require-repl-utils-and- set-ns (buffer )
259
+ (defun cider-repl-set-initial -ns (buffer )
260
260
" Require standard REPL util functions and set the ns of the REPL's BUFFER.
261
261
Namespace is \" user\" by default, but can be overridden in apps like
262
262
lein (:init-ns). Both of these operations need to be done as a sync
@@ -265,17 +265,25 @@ efficiency."
265
265
; ; we don't want to get a timeout during init
266
266
(let ((nrepl-sync-request-timeout nil ))
267
267
(with-current-buffer buffer
268
- (let* ((command " (do (when (clojure.core/resolve 'clojure.main/repl-requires)
269
- (clojure.core/map clojure.core/require clojure.main/repl-requires))
270
- (str *ns*))" )
271
- (response (nrepl-send-sync-request
272
- (lax-plist-put (nrepl--eval-request command)
268
+ (let* ((response (nrepl-send-sync-request
269
+ (lax-plist-put (nrepl--eval-request " (str *ns*))" )
273
270
" inhibit-cider-middleware" " true" )
274
271
(cider-current-connection)))
275
272
(initial-ns (or (read (nrepl-dict-get response " value" ))
276
273
" user" )))
277
274
(cider-set-buffer-ns initial-ns)))))
278
275
276
+ (defun cider-repl-require-repl-utils ()
277
+ " Require standard REPL util functions into the current REPL."
278
+ (interactive )
279
+ (nrepl-send-sync-request
280
+ (lax-plist-put
281
+ (nrepl--eval-request
282
+ " (when (clojure.core/resolve 'clojure.main/repl-requires)
283
+ (clojure.core/map clojure.core/require clojure.main/repl-requires))" )
284
+ " inhibit-cider-middleware" " true" )
285
+ (cider-current-connection)))
286
+
279
287
(defvar cider-current-clojure-buffer nil
280
288
" This variable holds current buffer temporarily when connecting to a REPL.
281
289
It is set to current buffer when `cider' or `cider-jack-in' is called.
@@ -293,7 +301,8 @@ client process connection. Unless NO-BANNER is non-nil, insert a banner."
293
301
(pcase cider-repl-pop-to-buffer-on-connect
294
302
(`display-only (display-buffer buffer))
295
303
((pred identity) (pop-to-buffer buffer)))
296
- (cider-repl-require-repl-utils-and-set-ns buffer)
304
+ (cider-repl-set-initial-ns buffer)
305
+ (cider-repl-require-repl-utils)
297
306
(unless no-banner
298
307
(cider-repl--insert-banner-and-prompt buffer))
299
308
(cider-remember-clojure-buffer cider-current-clojure-buffer)
0 commit comments