Skip to content

Commit 7228402

Browse files
ericdallobbatsov
authored andcommitted
Make cider-after-eval-done-hook run on the same buffer that triggered the cider-before-eval-hook
1 parent d97dfa0 commit 7228402

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cider-client.el

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,17 @@ If NS is non-nil, include it in the request. LINE and COLUMN, if non-nil,
207207
define the position of INPUT in its buffer. ADDITIONAL-PARAMS is a plist
208208
to be appended to the request message. CONNECTION is the connection
209209
buffer, defaults to (cider-current-repl)."
210-
(let ((connection (or connection (cider-current-repl nil 'ensure))))
210+
(let ((connection (or connection (cider-current-repl nil 'ensure)))
211+
(eval-buffer (current-buffer)))
211212
(run-hooks 'cider-before-eval-hook)
212213
(nrepl-request:eval input
213214
(lambda (response)
214215
(when cider-show-eval-spinner
215216
(cider-eval-spinner connection response))
216-
(when (member "done" (nrepl-dict-get response "status"))
217-
(run-hooks 'cider-after-eval-done-hook))
217+
(when (and (buffer-live-p eval-buffer)
218+
(member "done" (nrepl-dict-get response "status")))
219+
(with-current-buffer eval-buffer
220+
(run-hooks 'cider-after-eval-done-hook)))
218221
(funcall callback response))
219222
connection
220223
ns line column additional-params)

0 commit comments

Comments
 (0)