[parenscript-devel] Importing ParenScript Macros

Andy Peterson andy.arvid at gmail.com
Fri Jan 11 21:54:18 UTC 2013


David,

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.

2. See
http://lists.common-lisp.net/pipermail/parenscript-devel/2011-January/000932.html
for
one solution.

This is my solution:

(defun compile-site-paren-file (name &optional check-date)
  (let ((inf (merge-pathnames (make-pathname :name name :type "paren")
                              *parenscript-dir*))
        (outf (merge-pathnames (make-pathname :name name :type "js")
                               *static-local-dir*)))
    (when (and (fad:file-exists-p inf)
               (or (not check-date)
                   (not (fad:file-exists-p outf))
                   (> (file-write-date inf) (file-write-date outf))))
      (with-open-file (in inf :direction :input)
        (with-open-file (out outf :direction :output
                                  :if-exists :supersede
                                  :if-does-not-exist :create)
          (let ((*parenscript-stream* out))
            (ps:ps-compile-stream in))
          outf)))))

Note: I use the paren extension for parenscript only files. The library fad
is http://weitz.de/cl-fad/. Though this does treat a whole directory it
could.  I prefer to be more explicit in what I am compiling.

andy





On Fri, Jan 11, 2013 at 11:41 AM, David Sargeant <david at dsargeant.com>wrote:

> I'm new to Common Lisp and ParenScript, so please forgive my questions if
> they are obvious.
>
> 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?
>
> 2. Is there some way to watch a directory for changes to *.lisp files, and
> automatically compile to *.js files?
>
>
> Thanks for the help,
> David
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20130111/72131dcc/attachment.html>


More information about the parenscript-devel mailing list