Description
Is your feature request related to a problem? Please describe.
I would like to control where the cider-spinner appears--specifically, in the file buffer where I'm eval'ing my code. Mentioned this in Slack: https://clojurians.slack.com/archives/C0617A8PQ/p1696125697359089. Others thought this would be a neat feature to have as well.
Describe the solution you'd like
Some sort of defcustom
that I can set.
Describe alternatives you've considered
I have the above working for me, but it's probably too hacky to include as a PR. I modified two lines in cider-client.el
and added one hook to my config to get the desired effect of having the spinner show in file buffer. The following are those changes; my code follows the commented out lines:
(defun cider-nrepl-request:eval (input callback &optional ns line column additional-params connection)
"Send the request INPUT and register the CALLBACK as the response handler.
If NS is non-nil, include it in the request. LINE and COLUMN, if non-nil,
define the position of INPUT in its buffer. ADDITIONAL-PARAMS is a plist
to be appended to the request message. CONNECTION is the connection
buffer, defaults to (cider-current-repl)."
(let ((connection (or connection (cider-current-repl nil 'ensure)))
(eval-buffer (current-buffer)))
(run-hooks 'cider-before-eval-hook)
(nrepl-request:eval input
(lambda (response)
(when cider-show-eval-spinner
;; (cider-eval-spinner connection response)
(cider-eval-spinner eval-buffer response))
(when (and (buffer-live-p eval-buffer)
(member "done" (nrepl-dict-get response "status")))
(with-current-buffer eval-buffer
(run-hooks 'cider-after-eval-done-hook)))
(funcall callback response))
connection
ns line column additional-params)
;; (cider-spinner-start connection)
(cider-spinner-start eval-buffer)))
(add-hook 'cider-after-eval-done-hook 'spinner-stop)
Additional context
I needed to add the 'spinner-stop to the 'cider-after-eval-done-hook, because the cider-eval-spinner
function wasn't seeming to receive the eval response, as far as I can tell.