Macroexpand in PLT Scheme - Version 1
Wednesday, November 12, 2003
Since scheme-mode in Emacs has no built-in support for expanding macros in Scheme, I've written some helper code to make it easier to do syntax expansions. I've made use of Eli Barzilay's "-test" expander code and have bound specific syntax expansion functionality to different keys. Once this code is installed and you are in scheme-mode, you can do the following:
- In a Scheme source file, position the cursor on the open parens of an s-expression that you want to work with and press "C-c RET" to select that sexp
- Press "C-c t" to show the current sexp that has been selected for expansion
- Press "C-c e" to fully expand the sexp
- Press "C-c o" to expand the sexp one step only
- Press "C-c *" to do multiple "one step" expansions
- Press "C-c p" to pretty-print the last expansion
To set it up, do the following:
- Download Eli Barzilay's -test macro from http://bc.tech.coop/expand.scm and copy the code into your MzScheme initialization file (it's called mzschemerc.ss on MS Windows but the name varies on different OS's)
- Download my emacs lisp code from http://bc.tech.coop/expand.el and copy the code into your .emacs file

