Skip to content

Commit 993a840

Browse files
yuhan0bbatsov
authored andcommitted
Add docs for eval registers
1 parent a9679d3 commit 993a840

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,34 @@ Additionally, there's the variable `cider-redirect-server-output-to-repl` that c
275275

276276
NOTE: The redirection functionality is implemented in `cider-nrepl` as nREPL middleware. If you're using CIDER without `cider-nrepl` no output redirection is going to take place.
277277

278+
279+
280+
=== Storing eval results
281+
282+
By default CIDER stores the return value of the most recent evaluation command
283+
in the text register `e`. You can access these contents via `insert-register`
284+
(kbd:[C-x r i]).
285+
286+
This is often useful for closer inspection or textual manipulation of a
287+
transiently displayed eval result, without having to re-evaluate the form with a
288+
specialized command like `cider-insert-last-sexp-in-repl`.
289+
290+
You can customize which register is used with the variable `cider-eval-register`, or set
291+
it to `nil` to disable the feature.
292+
293+
[source,lisp]
294+
----
295+
(setq cider-eval-register nil)
296+
----
297+
298+
TIP: The built-in xref:debugging/inspector.adoc[inspector] can be used to view
299+
and navigate through complex nested results.
300+
301+
You can also use the command `cider-kill-last-result`(kbd:[C-c C-v k]) after any
302+
eval command to store its result in the kill ring. This works even when the
303+
`cider-eval-register` feature is disabled.
304+
305+
278306
== Keybindings
279307

280308
You might have noticed that CIDER typically has 2-3 different keybindings for
@@ -383,6 +411,10 @@ kbd:[C-u C-c C-c]
383411
| `cider-load-all-files`
384412
| kbd:[C-c C-M-l]
385413
| Load (eval) all Clojure files below a directory.
414+
415+
| `cider-kill-last-result`
416+
| kbd:[C-c C-v k]
417+
| Save the last evaluated result into the kill ring.
386418
|===
387419

388420
TIP: You'll find all evaluation commands and their keybindings in the `CIDER Eval` menu.

0 commit comments

Comments
 (0)