[cl-who-devel] Macro expansion...

Andrei Stebakov lispercat at gmail.com
Fri Aug 15 21:09:35 UTC 2008


I am trying to incorporate parenscript into cl-who tree. I tried to insert a
small macro but for some reasons I get various errors linke "cl-who:fmt not
defined" or ":script not defined".
I guess I need help to figure out the way macros work with cl-who...

(defmacro js-body (&rest body)
  `(:script :type "text/javascript"
            (fmt
             (ps
               , at body))))

(with-html-output-to-string (*standard-output* nil :prologue nil :indent
nil)
   (:html
    (:head (:title "Some title"))
    (js-body
     (defun some-func ()
       (alert "Hello!")))))

I think parenscript is not really relevant to the task, so I am looking for
some help to figure out why I have these expansion errors.
BTW, when I run
(macroexpand
 '(with-html-output-to-string (*standard-output* nil :prologue nil :indent
nil)
   (:html
    (:head (:title "Some title"))
    (js-body
     (defun some-func ()
       (alert "Hello!"))))))

I get:

(LET ((*STANDARD-OUTPUT* (MAKE-STRING-OUTPUT-STREAM :ELEMENT-TYPE
'CHARACTER)))
  (UNWIND-PROTECT
      (PROGN
       (WITH-HTML-OUTPUT (*STANDARD-OUTPUT* NIL :PROLOGUE NIL :INDENT NIL)
                         (:HTML (:HEAD (:TITLE "Some title"))
                          (JS-BODY (DEFUN SOME-FUNC () (ALERT "Hello!"))))))
    (CLOSE *STANDARD-OUTPUT*))
  (GET-OUTPUT-STREAM-STRING *STANDARD-OUTPUT*))

The HyperSpec says: "*macroexpand* <#macroexpand> repeatedly expands
*form*until it is no longer a
*macro form"* <26_glo_m.htm#macro_form>
Why js-body or with-html-output doesn't get expanded in this case? I am
using sbcl 1.0.18 on Ubuntu.

Thank you!
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-who-devel/attachments/20080815/22edf645/attachment.html>


More information about the Cl-who-devel mailing list