In SBCL, ASDF hooks into
the REQUIRE mechanism so
you can type
(require 'mysystem). On other systems you
can also figure out a way to hook REQUIRE, so you can avoid
(asdf:oos 'asdf:load-op 'mysystem).
I got tired of trying to figure out how to do this in different
ways on different Lisp systems, so below is a file I've been loading from
my init files to get consistent, concise ASDF loading across
implementations. It also adds a crude registry maintenance system
and a way to reload a system without using
:FORCE has the downside of recompiling and reloading
all other dependencies, which is never what I want.
It's a work in progress, but so far I've been pretty happy
(asdf:load* 'mysystem) and
(require 'asdf) (in-package #:asdf) (export '(load* reload register register-permanently)) (defvar *registry-file* (merge-pathnames (make-pathname :directory '(:relative "asdf") :name "registry" :type "sexp") (user-homedir-pathname))) (eval-when (:compile-toplevel :load-toplevel :execute) (let ((registry (probe-file *registry-file*))) (when registry (with-open-file (stream registry) (loop for form = (read stream nil) while form do (push form *central-registry*)) (setf *central-registry* (remove-duplicates *central-registry* :test #'equalp)))))) (defun load* (system &key verbose) (oos 'load-op system :verbose verbose) t) (defun reload (system) (let ((name (coerce-name system))) (remhash name *defined-systems*) (load* name))) (defun register (form) (pushnew form *central-registry* :test #'equalp)) (defun register-permanently (form) (register form) (ensure-directories-exist *registry-file*) (with-open-file (stream *registry-file* :direction :output :if-exists :append :if-does-not-exist :create) (prin1 form stream) (terpri stream))) ;;; Automatically recompile stale FASLs (handler-bind ((style-warning #'muffle-warning)) (defmethod perform :around ((o load-op) (c cl-source-file)) (handler-case (call-next-method o c) (#+sbcl sb-ext:invalid-fasl #-sbcl error () (perform (make-instance 'compile-op) c) (call-next-method)))))
Do you have any ugly local hacks that you think aren't polished enough to share, but that make your life much easier? Share them anyway, and let's clean them up and use them and improve life everywhere.