Skip to content

Instantly share code, notes, and snippets.

@cursive-ide
Last active August 29, 2015 14:14
Show Gist options
  • Save cursive-ide/593ee7421e765d1b0dba to your computer and use it in GitHub Desktop.
Save cursive-ide/593ee7421e765d1b0dba to your computer and use it in GitHub Desktop.
Cursive Macroexpander
The other new feature is an interactive macroexpander. It requires a REPL to perform
the actual expansion, with the current namespace loaded into it. Start by executing
Tools->REPL->View Macro Expansion. This will select the nearest surrounding macro
form and display it in a popup window. You can move the cursor anywhere within the
form and either click the right arrow in the toolbar or use Ctrl/Cmd-right - this
will expand the nearest surrounding macro form and all forms above it up to the
top displayed form - the cursor will be left at the start of the innermost form
that was actually expanded. Give it a try, it’s less confusing than it sounds!
There are also various controls in the toolbar for various sorts of prettification -
you can show and hide metadata, tidy up referred vars and imported classes etc. This
expander should be much more accurate than most, it correctly maintains &env when
expanding and does its best with metadata. Currently this only works for Clojure
macros, but I’ll add support for expanding ClojureScript macros soon.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment