Utilities to assist with REPL-oriented development.

If you are using Stuart Sierra’s component library, you may want to also require io.aviso.component.


added in 1.3.0

(-main & args)

Installs pretty exceptions, then delegates to clojure.main/main.


added in 0.1.32


Copies the current contents of the Clipboard, returning its contents as a string.

This makes use of AWT; it will throw java.awt.HeadlessException when AWT is not available, for example, when the JVM is launched with -Djava.awt.headless=true.


added in 0.1.32

(format-exception)(format-exception text)

Passed the standard exception text and formats it using parse-exception and write-exception, returning the formatted exception text.

With no arguments, parses the clipboard text and prints the formatted exception to *out* (returning nil).



Installs an override that outputs pretty exceptions when caught by the main REPL loop. Also, overrides clojure.repl/pst, clojure.stacktrace/print-stack-trace, clojure.stacktrace/print-cause-trace.

In addition, installs an uncaught-exception-handler so that uncaught exceptions in non-REPL threads will be printed reasonably. See io.aviso.logging for a better handler, used when is available.

Caught exceptions do not print the stack trace; the pst replacement does.


added in 0.1.32

(paste s)

Pastes a string in as the new content of the Clipboard.

This can be helpful when, for example, pretty printing some EDN content from a log file before pasting it into some other editor.


added in 0.1.32

(pretty-print)(pretty-print object)

Pretty-prints the supplied object to a returned string.

With no arguments, copies from the clipboard, parses as EDN, and prints the EDN data to *out*, returning nil.


(pretty-print-stack-trace tr)(pretty-print-stack-trace tr n)

Replacement for clojure.stacktrace/print-stack-trace and print-cause-trace. These functions are used by clojure.test.


(pretty-pst)(pretty-pst e-or-depth)(pretty-pst e depth)

Used as an override of clojure.repl/pst but uses pretty formatting.


(pretty-repl-caught e)

A replacement for clojure.main/repl-caught that prints the exception to *err*, without a stack trace or properties.


added in 0.1.18


Returns a reified UncaughtExceptionHandler that prints the formatted exception to *err*.