From: danb
Subject: readtables, slime, & asdf
Date: 
Message-ID: <227a2f78-24b6-4bda-b897-18274d7dab48@8g2000hse.googlegroups.com>
How do you juggle readtables in slime and asdf?  You have to wrap the
call to compile-file or (load source-file) in a rebinding of
*readtable*, right?  Is there some combination of asdf :perform and/
or :in-order-to options that works?  I don't see a description
of :perform in the asdf manual.  Also, what about slime?  I haven't
checked the docs yet, but it's a similar question.

--Dan

------------------------------------------------
Dan Bensen  http://www.prairienet.org/~dsb/

cl-match:  expressive pattern matching in Lisp
http://common-lisp.net/project/cl-match/

From: Edi Weitz
Subject: Re: readtables, slime, & asdf
Date: 
Message-ID: <uzlqqbh5q.fsf@agharta.de>
On Fri, 16 May 2008 04:37:05 -0700 (PDT), danb <·········@gmail.com> wrote:

> How do you juggle readtables in slime and asdf?  You have to wrap
> the call to compile-file or (load source-file) in a rebinding of
> *readtable*, right?  Is there some combination of asdf :perform and/
> or :in-order-to options that works?  I don't see a description of
> :perform in the asdf manual.  Also, what about slime?  I haven't
> checked the docs yet, but it's a similar question.

Below is something that I once did to integrate some legacy code which
didn't have package definitions in it.  Not about readtables, but
maybe that'll give you an idea for ASDF.

Edi.


  (defclass foo-core-cl-source-file (cl-source-file)
    ()
    (:documentation "We subclass ASDF's CL-SOURCE-FILE so that we can
  specialize some generic functions.  This is the class for all core
  files which don't have a package definition."))

  (defmethod perform ((operation compile-op) (c foo-core-cl-source-file))
    "Make sure that files without a package definition are compiled as
  if they were in the FOO package."
    (let ((*package* (find-package :foo)))
      (call-next-method)))

  (defmethod perform ((operation load-op) (c foo-core-cl-source-file))  
    "Make sure that files without a package definition are loaded as if
  they were in the FOO package."
    (let ((*package* (find-package :foo)))
      (call-next-method)))

  (defsystem :foo-core
      :serial t
      :components ((:file "packages")
                   (:file "init")
                   ;; all the files below are unaltered files from the
                   ;; core
                   (:foo-core-cl-source-file "globals")
                   ...))

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: danb
Subject: Re: readtables, slime, & asdf
Date: 
Message-ID: <063d817d-6e05-4570-a453-e4318cf3e249@l42g2000hsc.googlegroups.com>
> On Fri, 16 May 2008 04:37:05 -0700 (PDT), danb <·········@gmail.com> wrote:
> > How do you juggle readtables in slime and asdf?

On May 16, 6:52 am, Edi Weitz <········@agharta.de> wrote:
>   (defclass foo-core-cl-source-file (cl-source-file)
>     ...
>   (defmethod perform ((operation compile-op) (c foo-core-cl-source-file))
>     (let ((*package* (find-package :foo)))
>       (call-next-method)))
>   (defmethod perform ((operation load-op) (c foo-core-cl-source-file))
>     ...
>   (defsystem :foo-core
>       ...
>       (:foo-core-cl-source-file "globals")
>       ..,

Thanks Edi, I think that answers most of my questions.
Slime probably isn't as hard, so I'll just RTFM.

--Dan

------------------------------------------------
Dan Bensen  http://www.prairienet.org/~dsb/

cl-match:  expressive pattern matching in Lisp
http://common-lisp.net/project/cl-match/
From: danb
Subject: Re: readtables, slime, & asdf
Date: 
Message-ID: <3b02cc15-43e6-4b63-bb7f-3bded97b7233@24g2000hsh.googlegroups.com>
>   (defsystem :foo-client
>       :depends-on (foo-lib)
>       :components ((:foo-file "client")))

I want to define the component class foo-file in foo-lib.
How do you get asdf to load the library first, before
trying to process the client's components?

--Dan

------------------------------------------------
Dan Bensen  http://www.prairienet.org/~dsb/

cl-match:  expressive pattern matching in Lisp
http://common-lisp.net/project/cl-match/
From: danb
Subject: Re: readtables, slime, & asdf
Date: 
Message-ID: <2816f272-fc86-4d5a-ae48-37e64c88755b@x41g2000hsb.googlegroups.com>
On May 17, 4:52 am, danb <·········@gmail.com> wrote:
> >   (defsystem :foo-client
> >       :depends-on (foo-lib)
> >       :components ((:foo-file "client")))
> I want to define the component class foo-file in foo-lib.
> How do you get asdf to load the library first, before
> trying to process the client's components?

So is there no way around this problem?  Does asdf
really try to find component classes before the
current system's dependencies have been processed?

--Dan

------------------------------------------------
Dan Bensen  http://www.prairienet.org/~dsb/

cl-match:  expressive pattern matching in Lisphttp://common-lisp.net/project/cl-match/
From: Mark Wooding
Subject: Re: readtables, slime, & asdf
Date: 
Message-ID: <slrng36p1u.ihm.mdw@metalzone.distorted.org.uk>
danb <·········@gmail.com> wrote:

> How do you juggle readtables in slime and asdf?  You have to wrap the
> call to compile-file or (load source-file) in a rebinding of
> *readtable*, right?  

I thought LOAD rebound *READTABLE* itself (to its current value).  I
usually just say

  (eval-when (:compile-toplevel :execute)
    (setf *readtable* (copy-readtable))
    ;; hack readtable...
    )

near the top of interesting files.  (I've not written it /quite/ enough
to bother writing a macro yet, but it's close...)

-- [mdw]
From: danb
Subject: Re: readtables, slime, & asdf
Date: 
Message-ID: <1985e1a3-bbc8-40d4-bd35-807c7fe6d930@b1g2000hsg.googlegroups.com>
> danb <·········@gmail.com> wrote:
> > How do you juggle readtables in slime and asdf?
> > You have to wrap the call to compile-file or
> > (load source-file) in a rebinding of *readtable*,
> > right?

On May 20, 6:52 pm, Mark Wooding wrote:
> I thought LOAD rebound *READTABLE* itself
>   (eval-when (:compile-toplevel :execute)
>     (setf *readtable* (copy-readtable))

We have a winner!  I noticed that in CLtL2
a couple days ago.  Too bad the example is
elided in the CLHS (AFAICT), it's a big help.

--Dan

------------------------------------------------
Dan Bensen  http://www.prairienet.org/~dsb/

cl-match:  expressive pattern matching in Lisp
http://common-lisp.net/project/cl-match/