Added a mechanism for expanding parenscript forms in a clean environment.
authorTravis Cross <tc@traviscross.com>
Sun, 30 Mar 2008 22:51:16 +0000 (22:51 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 30 Mar 2008 22:51:16 +0000 (22:51 +0000)
extras/js-expander.el
src/compilation-interface.lisp
src/package.lisp

index 05b6f6b..114d6c1 100644 (file)
@@ -45,3 +45,4 @@
 
 ;;; 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)
index 4817370..96b4cff 100644 (file)
@@ -11,6 +11,12 @@ is output to the OUTPUT-STREAM stream."
 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."
index 933aa64..779fc4d 100644 (file)
    ;; compiler
    #:compile-script
    #:ps
+   #:ps-doc
    #:ps*
    #:ps-inline
    #:ps-inline*