Skip to content

Commit d832797

Browse files
committed
review items
1 parent 23b1445 commit d832797

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

cider-ns.el

+16-16
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ namespace-qualified function of zero arity."
118118
:group 'cider
119119
:package-version '(cider . "0.10.0"))
120120

121-
(defcustom cider-ns-refresh-tool 'tools.namespace
121+
(defcustom cider-ns-code-reload-tool 'tools.namespace
122122
"Which tool to use for ns refresh.
123123
Current options: tools.namespace and clj-reload."
124124
:group 'cider
125-
:type '(choice (const :tag "tools.namespace https://github.com/clojure/tools.namespace" tools-namespace)
125+
:type '(choice (const :tag "tools.namespace https://github.com/clojure/tools.namespace" tools.namespace)
126126
(const :tag "clj-reload https://github.com/tonsky/clj-reload" clj-reload))
127-
:package-version '(cider . "1.13.1"))
127+
:package-version '(cider . "1.14.0"))
128128

129129
(defun cider-ns--present-error (error)
130130
"Render the `ERROR' stacktrace,
@@ -234,18 +234,18 @@ Its behavior is controlled by `cider-ns-save-files-on-refresh' and
234234
(file-in-directory-p buffer-file-name dir))
235235
dirs)))))))
236236

237-
(defun cider-ns-refresh--refresh-op (op-name)
238-
"Return the refresh operation to use.
239-
Based on OP-NAME and the value of cider-ns-refresh-tool defcustom."
237+
(defun cider-ns--reload-op (op-name)
238+
"Return the reload operation to use.
239+
Based on OP-NAME and the value of cider-ns-code-reload-tool defcustom."
240240
(list "op"
241-
(cond
242-
((eq cider-ns-refresh-tool 'tools.namespace)
243-
op-name)
241+
(if (eq cider-ns-code-reload-tool 'tools.namespace)
242+
(cond ((string= op-name "reload") "refresh")
243+
((string= op-name "reload-all") "refresh-all")
244+
((string= op-name "reload-clear") "refresh-clear"))
244245

245-
((eq cider-ns-refresh-tool 'clj-reload)
246-
(cond ((string= op-name "refresh") "cider.clj-reload/reload")
247-
((string= op-name "refresh-all") "cider.clj-reload/reload-all")
248-
((string= op-name "refresh-clear") "cider.clj-reload/reload-clear"))))))
246+
(cond ((string= op-name "reload") "cider.clj-reload/reload")
247+
((string= op-name "reload-all") "cider.clj-reload/reload-all")
248+
((string= op-name "reload-clear") "cider.clj-reload/reload-clear")))))
249249

250250
;;;###autoload
251251
(defun cider-ns-reload (&optional prompt)
@@ -302,7 +302,7 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and
302302
(cider-ensure-op-supported "cider.clj-reload/reload")
303303
(cider-ns-refresh--save-modified-buffers)
304304
(let ((clear? (member mode '(clear 16)))
305-
(refresh-all? (member mode '(refresh-all 4)))
305+
(all? (member mode '(refresh-all 4)))
306306
(inhibit-refresh-fns (member mode '(inhibit-fns -1))))
307307
(cider-map-repls :clj
308308
(lambda (conn)
@@ -317,11 +317,11 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and
317317
nil
318318
t))
319319
(when clear?
320-
(cider-nrepl-send-sync-request (cider-ns-refresh--refresh-op "refresh-clear") conn))
320+
(cider-nrepl-send-sync-request (cider-ns--reload-op "reload-clear") conn))
321321
(cider-nrepl-send-request
322322
(thread-last
323323
(map-merge 'list
324-
`(,(cider-ns-refresh--refresh-op (if refresh-all? "refresh-all" "refresh")))
324+
`(,(cider-ns--reload-op (if all? "reload-all" "reload")))
325325
(cider--nrepl-print-request-map fill-column)
326326
(when (and (not inhibit-refresh-fns) cider-ns-refresh-before-fn)
327327
`(("before" ,cider-ns-refresh-before-fn)))

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

+17-2
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,28 @@ and `cider-ns-reload-all` commands can be used instead. These commands
130130
invoke Clojure's `+(require ... :reload)+` and `+(require
131131
... :reload-all)+` commands at the REPL.
132132

133-
You can also use https://github.com/tonsky/clj-reload[clj-reload] instead:
133+
You can also use https://github.com/tonsky/clj-reload[clj-reload] instead.
134+
It provides supports
135+
https://github.com/tonsky/clj-reload?tab=readme-ov-file#usage-keeping-vars-between-reloads[keeping vars between reloads]
136+
among some
137+
https://github.com/tonsky/clj-reload?tab=readme-ov-file#comparison-toolsnamespace[other differences]
138+
from `tools.namespace`.
134139

135140
[source,lisp]
136141
----
137-
(setq cider-ns-refresh-tool 'clj-reload)
142+
(setq cider-ns-code-reload-tool 'clj-reload)
138143
----
139144

145+
With `clj-reload` you should set the source dirs as described in
146+
https://github.com/tonsky/clj-reload?tab=readme-ov-file#usage[the usage docs]
147+
. If you don't set them manually, it will default to the current source dirs in the same
148+
way `tools.namespace` does.
149+
150+
Another difference is that `cider-ns-refresh-before-fn` and `cider-ns-refresh-after-fn` are
151+
not used with `clj-reload`, but in turns it supports per-namespace
152+
https://github.com/tonsky/clj-reload?tab=readme-ov-file#usage-unload-hooks[unload hooks]
153+
.
154+
140155
== CIDER Selector
141156

142157
The `cider-selector` (kbd:[C-c M-s]) command allows you to quickly navigate to

0 commit comments

Comments
 (0)