On Sun, May 6, 2012 at 3:27 PM, Stelian Ionescu sionescu@cddr.org wrote:
I'm using the elisp snippet below(courtesy of Stas Boukarev with some modifications) to reload a .asd file. Is asdf::load-sysdef the best way to trigger a reload(but not recompilation) ?
Yes, with a catch: IF there's a system in your central-registry, source-registry, quicklisp registry, or wherever locate-system will find it, then that OTHER system will be found by the next find-system, as called whenever you try to compile it.
So load-sysdef will only help you define a system that CANNOT be found by locate-system.
What if you want to override what locate-system finds? Well, then override your source-registry, by exporting CL_SOURCE_REGISTRY, or giving an explicit parameter to asdf:initialize-source-registry. And the system is located by some other hook that has precedence over the source-registry (e.g. *central-registry*), then it's your responsibility to properly configure that hook.
Use case: I want to work on a system that isn't in the ASDF path, it being one of the many development trees I have around(e.g. CFFI), so I want to be able to say that "this cffi.asd is the CFFI to use during this session". Any ideas ?
If the session is well-defined enough to have some initial incantation or configuration file, I would use something like this to set it up:
(asdf:initialize-source-registry '(:source-registry (:tree "/path/to/overriding/cffi") (:tree "/path/to/other/overriding/library") :inherit-configuration))
Or, a bit more brutal and old-fashioned: (pushnew #p"/path/to/overriding/cffi/" asdf:*central-registry*) (pushnew #p"/path/to/overriding/cffi/uffi-compat/" asdf:*central-registry*)
If you want a 100% answer for a dynamically defined SLIME-directed session, where whichever .asd file you load incrementally modifies current session, I'd add another hook in front of asdf:*system-definition-search-functions*, that remembers whichever .asd you load that way, then calls load-sysdef. That would be a nice addition to slime's asdf support.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org To do evil a human being must first of all believe that what he's doing is good. — Alexander Solzhenitsyn