Skip to content

Commit 9acb56a

Browse files
[stacktrace] Set cider--ancillary-buffer-repl for *cider-error*
1 parent 02e83cf commit 9acb56a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cider-eval.el

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,19 @@ 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
303304
don't bring it forward."
304305
(when causes
305-
(let ((error-buffer (cider-new-error-buffer #'cider-stacktrace-mode
306-
error-types is-compilation)))
306+
(let* ((repl (or repl (cider-current-repl)))
307+
(error-buffer (cider-new-error-buffer #'cider-stacktrace-mode
308+
error-types is-compilation)))
309+
(with-current-buffer error-buffer
310+
(setq cider--ancillary-buffer-repl repl))
307311
(cider-stacktrace-render error-buffer causes error-types))))
308312

309313
(defconst cider-clojure-compilation-error-phases-default-value
@@ -362,7 +366,8 @@ For others, pop up *cider-error* buffer."
362366
(nrepl-notify msg type))))
363367
;; Render stacktrace in *cider-error* buffer if it is a runtime error.
364368
(cider--render-stacktrace-causes
365-
causes nil (member ex-phase (cider-clojure-compilation-error-phases)))
369+
causes nil (member ex-phase (cider-clojure-compilation-error-phases))
370+
(with-current-buffer source-buffer (cider-current-repl)))
366371
;; If the error is a compilation error (which we normally don't show
367372
;; *cider-error* buffer for), or the error buffer is disabled, compensate for
368373
;; the lack of info with a overlay error. Verify that the provided buffer is

0 commit comments

Comments
 (0)