;;; This actually defines the expander. If the code above belongs in slime.el, the code below would go into .emacs
(slime-add-custom-expander "j" 'ps:ps "*ParenScript generated Javascript*" 'c-mode #'read)
+(slime-add-custom-expander "d" 'ps:ps-doc "*ParenScript generated Javascript*" 'c-mode #'read)
compiles those forms to a JavaScript string."
`(ps* '(progn ,@body)))
+(defmacro ps-doc (&body body)
+ "Expands Parenscript forms in a clean environment."
+ `(let ((*ps-gensym-counter* 0)
+ (*ps-special-variables* nil))
+ (ps ,@body)))
+
(defun ps* (&rest body)
"Compiles BODY to a JavaScript string.
Body is evaluated."