Skip to content

Commit 23b2c17

Browse files
committed
3834 Change cider-ns-refresh to use clj repl
1 parent af63db1 commit 23b2c17

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
- Bump the injected `nrepl` to [1.4.0](https://github.com/nrepl/nrepl/blob/master/CHANGELOG.md#140-2025-09-02).
1010
- Bump the injected `piggieback` to [0.6.1](https://github.com/nrepl/piggieback/blob/master/CHANGES.md#061-2025-12-31).
11+
- [#3834](https://github.com/clojure-emacs/cider/issues/3834): Change cider-ns-refresh to always use Clojure REPL
1112

1213
### Bugs fixed
1314

cider-client.el

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,10 @@ Skip check if repl is active if SKIP-ENSURE is non nil."
175175
nil
176176
'ensure)))))
177177

178-
(defun cider-ensure-op-supported (op)
179-
"Check for support of middleware op OP.
178+
(defun cider-ensure-op-supported (op &optional connection)
179+
"Check for support of middleware op OP for CONNECTION.
180180
Signal an error if it is not supported."
181-
(unless (cider-nrepl-op-supported-p op)
181+
(unless (cider-nrepl-op-supported-p op connection)
182182
(user-error "`%s' requires the nREPL op \"%s\" (provided by cider-nrepl)" this-command op)))
183183

184184
(defun cider-nrepl-send-request (request callback &optional connection tooling)
@@ -623,12 +623,12 @@ Optional arguments include SEARCH-NS, DOCS-P, PRIVATES-P, CASE-SENSITIVE-P."
623623
(user-error "Invalid regexp: %s" (nrepl-dict-get response "error-msg"))
624624
(nrepl-dict-get response "apropos-matches"))))
625625

626-
(defun cider-sync-request:classpath ()
627-
"Return a list of classpath entries."
628-
(cider-ensure-op-supported "classpath")
626+
(defun cider-sync-request:classpath (&optional connection)
627+
"Return a list of classpath entries for CONNECTION."
628+
(cider-ensure-op-supported "classpath" connection)
629629
(thread-first
630630
'("op" "classpath")
631-
(cider-nrepl-send-sync-request)
631+
(cider-nrepl-send-sync-request connection)
632632
(nrepl-dict-get "classpath")))
633633

634634
(defun cider--get-abs-path (path project)

cider-ns.el

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,13 @@ presenting the error message as an overlay."
219219
error)
220220
(cider-ns--present-error error))))
221221

222-
(defun cider-ns-refresh--save-modified-buffers ()
223-
"Ensure any relevant modified buffers are saved before refreshing.
222+
(defun cider-ns-refresh--save-modified-buffers (&optional connection)
223+
"Ensure any relevant modified buffers for CONNECTION are saved before refreshing.
224224
Its behavior is controlled by `cider-ns-save-files-on-refresh' and
225225
`cider-ns-save-files-on-refresh-modes'."
226226
(when cider-ns-save-files-on-refresh
227227
(let ((dirs (seq-filter #'file-directory-p
228-
(cider-classpath-entries))))
228+
(cider-classpath-entries connection))))
229229
(save-some-buffers
230230
(not (eq cider-ns-save-files-on-refresh 'prompt))
231231
(lambda ()
@@ -297,14 +297,14 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and
297297
`cider-ns-refresh-after-fn') from being invoked."
298298
(interactive "p")
299299
(cider-ensure-connected)
300-
(cider-ensure-op-supported "refresh")
301-
(cider-ensure-op-supported "cider.clj-reload/reload")
302-
(cider-ns-refresh--save-modified-buffers)
303300
(let ((clear? (member mode '(clear 16)))
304301
(all? (member mode '(refresh-all 4)))
305302
(inhibit-refresh-fns (member mode '(inhibit-fns -1))))
306303
(cider-map-repls :clj
307304
(lambda (conn)
305+
(cider-ensure-op-supported "refresh" conn)
306+
(cider-ensure-op-supported "cider.clj-reload/reload" conn)
307+
(cider-ns-refresh--save-modified-buffers conn)
308308
;; Inside the lambda, so the buffer is not created if we error out.
309309
(let ((log-buffer (or (get-buffer cider-ns-refresh-log-buffer)
310310
(cider-make-popup-buffer cider-ns-refresh-log-buffer))))

doc/modules/ROOT/pages/usage/cider_mode.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ kbd:[C-u C-c C-c]
175175

176176
| `cider-ns-refresh`
177177
| kbd:[C-c M-n (M-)r]
178-
| Reload all modified files on the classpath. If invoked with a prefix argument, reload all files on the classpath. If invoked with a double prefix argument, clear the state of the namespace tracker before reloading.
178+
| Reload all modified files on the classpath. If invoked with a prefix argument, reload all files on the classpath. If invoked with a double prefix argument, clear the state of the namespace tracker before reloading. Uses a clojure REPL whenever one exists.
179179

180180
| `cider-doc`
181181
| kbd:[C-c C-d d] +

0 commit comments

Comments
 (0)