common-lispread-eval-print-loopsbclasdf

Why do I need to evaluate defpackage for a new REPL?


I use ADSF to organise my projects.

(asdf:defsystem :sender
  :version "0.1.4"
  :serial t
  :depends-on (:cl-json :dexador :clsql :clsql-sqlite3)
  :components ((:file "packages")
               (:file "validation")
               (:file "sender")))

But when I open a new repl (slime, emacs), I have to go to the packages.lisp file and evaluate the form before I can change the repl to that package with (in-package :sender).

Is there a way to make the slime repl remember my packages?

My current thinking is that I need to "run" adsf to load all my files. If so, how?

UPDATE:

Actually, I need to compile all the files manually before I can actively use them in the repl. I believe I am using asdf incorrectly.


Solution

  • From a .asd system definition, the steps would be:

    You can add stuff to your ~/.sbclrc (or similar for other implementations). Here I tell ASDF where a project lives, so I can quickload it without manually compiling the .asd before:

    (pushnew "/home/vince/projets/ciel/" asdf:*central-registry* :test #'equal)
    

    This is an "old" style not encouraged anymore by the ASDF documentation.

    Or simply create a symlink for your project to ~/quicklisp/local-projects/ or ~/common-lisp/.

    I wouldn't "load-system" my project in the init file, because that's a side effect that would show sometimes when I don't want it (like building an image: if that involves reading my init file, I'd have an unwanted system in it).

    Saving a core image with a ton of dependencies is cool. Use it with sbcl --core …. The advantage is that it starts up instantly in the REPL, when loading all projects and dependencies would take a few seconds.