@@ -295,15 +295,21 @@ When clojure.stracktrace is not present."
295
295
(cider-nrepl-sync-request:eval
296
296
" (println (ex-data *e))" )))
297
297
298
- (defun cider--render-stacktrace-causes (causes &optional error-types is-compilation )
298
+ (defun cider--render-stacktrace-causes (causes &optional error-types
299
+ is-compilation repl )
299
300
" If CAUSES is non-nil, render its contents into a new error buffer.
300
301
Optional argument ERROR-TYPES contains a list which should determine the
301
302
op/situation that originated this error.
302
303
If IS-COMPILATION is true, render the stacktrace into the error buffer but
303
- don't bring it forward."
304
+ don't bring it forward.
305
+ REPL connection can be provided to set it as the connection for the created
306
+ *cider-error* buffer."
304
307
(when causes
305
- (let ((error-buffer (cider-new-error-buffer #'cider-stacktrace-mode
306
- error-types is-compilation)))
308
+ (let* ((repl (or repl (cider-current-repl)))
309
+ (error-buffer (cider-new-error-buffer #'cider-stacktrace-mode
310
+ error-types is-compilation)))
311
+ (with-current-buffer error-buffer
312
+ (setq cider--ancillary-buffer-repl repl))
307
313
(cider-stacktrace-render error-buffer causes error-types))))
308
314
309
315
(defconst cider-clojure-compilation-error-phases-default-value
@@ -362,7 +368,8 @@ For others, pop up *cider-error* buffer."
362
368
(nrepl-notify msg type))))
363
369
; ; Render stacktrace in *cider-error* buffer if it is a runtime error.
364
370
(cider--render-stacktrace-causes
365
- causes nil (member ex-phase (cider-clojure-compilation-error-phases)))
371
+ causes nil (member ex-phase (cider-clojure-compilation-error-phases))
372
+ (with-current-buffer source-buffer (cider-current-repl)))
366
373
; ; If the error is a compilation error (which we normally don't show
367
374
; ; *cider-error* buffer for), or the error buffer is disabled, compensate for
368
375
; ; the lack of info with a overlay error. Verify that the provided buffer is
0 commit comments