Misc Debugging Tools

Expanding Macros

Typing C-c C-m after some form in a source buffer or the REPL will show you the macro expansion of the form in a new buffer. You’ll have access to additional keybindings in the macro expansion buffer (which is internally using cider-macroexpansion-mode):

Keyboard shortcut Description

m

Invoke macroexpand-1 on the form at point and replace the original form with its expansion. If invoked with a prefix argument, macroexpand is used instead of macroexpand-1.

a

Invoke clojure.walk/macroexpand-all on the form at point and replace the original form with its expansion.

g

The prior macro expansion is performed again and the current contents of the macro expansion buffer are replaced with the new expansion.

C-/
u

Undo the last in-place expansion performed in the macroexpansion buffer.

Inspecting Values

Typing C-c M-i after some form in a source buffer or the REPL will show you the structure for the result of the form in a new buffer. You can also use C-u C-c M-i to inspect the result of the current top-level form and C-u C-u C-c M-i to read an expression from the minibuffer and inspect its result. You’ll have access to additional keybindings in the inspector buffer (which is internally using cider-inspector-mode):

Keyboard shortcut Description

Tab or Shift-Tab

Navigate inspectable sub-objects

Return

Inspect sub-objects

l

Pop to the parent object

g

Refresh the inspector (e.g. if viewing an atom/ref/agent)

SPC

Jump to next page in paginated view

M-SPC

Jump to previous page in paginated view

s

Set a new page size in paginated view

d

Defines a var with current inspector value