(DEFUN ADD-SOURCE-DIRECTORY-TO-ASDF (DIR) (ASDF:INITIALIZE-SOURCE-REGISTRY `(:source-registry (:DIRECTORY ,DIR) :inherit-configuration)))
and
(ADD-SOURCE-DIRECTORY-TO-ASDF (uiop:getcwd)) ?
This doesn't *add* the directory to the configuration, but each time overwrites the previous configuration to use this directory, then the rest of the normal configuration from environment variables, configuration files, defaults, etc.
Ah. I see that I didn't understand the semantics of :INHERIT-CONFIGURATION. I thought it inherited the *current* configuration, but if I understand your response above, :INHERIT-CONFIGURATION means something more like "recompute the configuration based on the standard configuration inputs (and add anything newly specified)."
inherit-configuration means "inherit from the next, wider, configuration method", as defined in *default-source-registries*: first, from the parameter, then from the environment, then from the user source registry file, then from his source registry directory, then from the system (i.e. unix machine, not lisp system) source registry file, then from its source registry directory, and finally from the implementation default. If you distrust or want to override some of them, you use :ignore-inherited-configuration. Otherwise, by default they all :inherit-configuration and you get everything in a priority order that makes sense (and is also compatible with the XDG standard for configuration).
So it's filesystem-spatial, not temporal, inheritance, if you want.
The other alternatives (rewrite your source-registry.conf, reset the environment variables, etc.) all seem to involve smashing one's lisp session and restarting. For an old school person like me, who treats his lisp session like his emacs session, and almost like his reboot cycle, this is somewhat unfortunate. Altering ASDF::*central-registry* doesn't have this same (to me) drawback....
You don't have to rewrite your source-registry.conf for something that's temporary. Maintain your list, and tuck it into the parameter you pass to initialize-source-registry, or push stuff to the central-registry. Re-initializing the source-registry does NOT smash anything about your lisp session; all it does is update where ASDF will find the systems.
The only builtin behavior that smashes your session is upgrading ASDF itself — which is why ASDF insists on doing it as the very first thing when you load a system, so that cannot happen in the middle of a build. But yes, if your registry has a new ASDF, then your next ASDF operation may smash your session. Oops. This could be alleviate by ASDF maintaining a "earliest version I'm sufficiently compatible with that I won't smash the current state if I upgrade from it", but that requires more testing, and I haven't tried it, and not enough people care to demand that feature. If upgrading ASDF in a live image is your kind of things, though, it's definitely a feature you'll want to add. I don't believe there has been any big change requiring smashing the session since 2.27, but that's now for you to test.
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org A peaceful communist? Take him to a place better run than his commune. Claims he the "extra" wealth around? not peaceful. If not, no commie.