File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -182,10 +182,21 @@ PROJECT-DIR, PORT and HOST are as in `nrepl-make-buffer-name'."
182182 (clojure.core/map clojure.core/require clojure.main/repl-requires))"
183183 (lambda (response ) nil )))
184184
185+ (defun cider-repl-set-initial-ns (buffer )
186+ " Set the REPL BUFFER's initial namespace (by altering `nrepl-buffer-ns' ).
187+ This is \" user\" by default but can be overridden in apps like lein (:init-ns)."
188+ ; ; we don't want to get a timeout during init
189+ (let ((nrepl-sync-request-timeout nil ))
190+ (with-current-buffer buffer
191+ (let ((initial-ns (read (nrepl-dict-get (nrepl-sync-request:eval " (str *ns*)" ) " value" ))))
192+ (when initial-ns
193+ (setq nrepl-buffer-ns initial-ns))))))
194+
185195(defun cider-repl-init (buffer &optional no-banner )
186196 " Initialize the REPL in BUFFER.
187197BUFFER must be a REPL buffer with `cider-repl-mode' and a running
188198client process connection. Unless NO-BANNER is non-nil, insert a banner."
199+ (cider-repl-set-initial-ns buffer)
189200 (cider-repl-require-repl-utils)
190201 (unless no-banner
191202 (cider-repl--insert-banner-and-prompt buffer))
You can’t perform that action at this time.
0 commit comments