<div dir="ltr">David,<div><br></div><div>1. there are lots of solutions. I have most of my macros is a separate library called parenscript-extensions. If it is a "local" macro, I just define it in the file it is used.</div>
<div><br></div><div style>2. See <a href="http://lists.common-lisp.net/pipermail/parenscript-devel/2011-January/000932.html">http://lists.common-lisp.net/pipermail/parenscript-devel/2011-January/000932.html</a> for one solution.</div>
<div style><br></div><div style>This is my solution:</div><div style><br></div><div style><div><font face="courier new, monospace">(defun compile-site-paren-file (name &optional check-date)</font></div><div><font face="courier new, monospace"> (let ((inf (merge-pathnames (make-pathname :name name :type "paren")</font></div>
<div><font face="courier new, monospace"> *parenscript-dir*))</font></div><div><font face="courier new, monospace"> (outf (merge-pathnames (make-pathname :name name :type "js")</font></div>
<div><font face="courier new, monospace"> *static-local-dir*)))</font></div><div><font face="courier new, monospace"> (when (and (fad:file-exists-p inf)</font></div><div><font face="courier new, monospace"> (or (not check-date)</font></div>
<div><font face="courier new, monospace"> (not (fad:file-exists-p outf))</font></div><div><font face="courier new, monospace"> (> (file-write-date inf) (file-write-date outf))))</font></div>
<div><font face="courier new, monospace"> (with-open-file (in inf :direction :input)</font></div><div><font face="courier new, monospace"> (with-open-file (out outf :direction :output</font></div><div><font face="courier new, monospace"> :if-exists :supersede</font></div>
<div><font face="courier new, monospace"> :if-does-not-exist :create)</font></div><div><font face="courier new, monospace"> (let ((*parenscript-stream* out))</font></div><div><font face="courier new, monospace"> (ps:ps-compile-stream in))</font></div>
<div><font face="courier new, monospace"> outf)))))</font></div></div><div style><br></div><div style>Note: I use the paren extension for parenscript only files. The library fad is <a href="http://weitz.de/cl-fad/">http://weitz.de/cl-fad/</a>. Though this does treat a whole directory it could. I prefer to be more explicit in what I am compiling.</div>
<div style><br></div><div style>andy</div><div style><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 11, 2013 at 11:41 AM, David Sargeant <span dir="ltr"><<a href="mailto:david@dsargeant.com" target="_blank">david@dsargeant.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm new to Common Lisp and ParenScript, so please forgive my questions if they are obvious.<br>
<br>
1. What is the best way to import a file of ParenScript macros so that the macro calls in the file I'm compiling can be properly expanded?<br>
<br>
2. Is there some way to watch a directory for changes to *.lisp files, and automatically compile to *.js files?<br>
<br>
<br>
Thanks for the help,<br>
David<br>
_______________________________________________<br>
parenscript-devel mailing list<br>
<a href="mailto:parenscript-devel@common-lisp.net">parenscript-devel@common-lisp.net</a><br>
<a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel" target="_blank">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel</a><br>
</blockquote></div><br></div>