Skip to content

Commit ddfc99b

Browse files
[stacktrace] Set cider--ancillary-buffer-repl for *cider-error*
1 parent 1f09098 commit ddfc99b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

cider-eval.el

+12-5
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,21 @@ When clojure.stracktrace is not present."
295295
(cider-nrepl-sync-request:eval
296296
"(println (ex-data *e))")))
297297

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)
299300
"If CAUSES is non-nil, render its contents into a new error buffer.
300301
Optional argument ERROR-TYPES contains a list which should determine the
301302
op/situation that originated this error.
302303
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."
304307
(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))
307313
(cider-stacktrace-render error-buffer causes error-types))))
308314

309315
(defconst cider-clojure-compilation-error-phases-default-value
@@ -362,7 +368,8 @@ For others, pop up *cider-error* buffer."
362368
(nrepl-notify msg type))))
363369
;; Render stacktrace in *cider-error* buffer if it is a runtime error.
364370
(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)))
366373
;; If the error is a compilation error (which we normally don't show
367374
;; *cider-error* buffer for), or the error buffer is disabled, compensate for
368375
;; the lack of info with a overlay error. Verify that the provided buffer is

0 commit comments

Comments
 (0)