common-lispquicklisp

asdf:load-system after closing emacs?


When I create a new project with quickprojects, and then load it with asdf:load-system, everything works fine.

But when I come back to emacs after it has been closed and a run (asdf:load-system "system-name"), I get an error:


Component "next" not found
   [Condition of type ASDF/FIND-COMPONENT:MISSING-COMPONENT]

I understood the package system to be like a project management system where I can load a package from the repl when I choose.

Which mistake am I making?


Solution

  • In quickproject.lisp, there is the following line:

    (pushnew *default-pathname-defaults* asdf:*central-registry*
             :test 'equal)
    

    Which is the reason why the system can be loaded: the path to your new project is pushed into ASDF's *central-registry*, which acts like the PATH environment variable in POSIX to indicate where to look for systems.

    This change is not persisted and the next time you start Lisp, the variable is set to its default value and the path is not set. I think Quickproject should at least warn that this is happening because it is not very intuitive1

    Usually you should add your projects in a path that is visible by ASDF, as explained in 4.1 Configuring ASDF to find your systems. Pushing to *central-registry* works but is old style: 4.2 Configuring ASDF to find your systems — old style.

    When using Quicklisp you can also define your projects in ~/quicklisp/local-projects/ (either directly or by using symlinks), which is a place that Quicklisp makes also visible by ASDF.

    You can temporarily bind *default-pathname-defaults* to one of these known locations when creating your projects, so that it can be found again when restarting your environment:

    (let ((*default-pathname-defaults*
            (merge-pathnames "quicklisp/local-projects/" 
                             (user-homedir-pathname)))
        (quickproject:make-project "test-project"))
    

    1. To Quickproject's defense, this is explained in the second sentence of the documentation:

    Quickproject provides a quick way to make a Common Lisp project. After creating a project, it extends the ASDF registry so the project may be immediately loaded.