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/
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")
> 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/
> (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/
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/
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]
> 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/