[asdf-devel] Reloading a .asd

Stelian Ionescu sionescu at cddr.org
Sun May 6 19:27:01 UTC 2012


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) ?

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 ?

(defvar slime-custom-file-loaders
  '(("asd"  . slime-load-asdf)
    ("lisp" . slime-load-file)))

(defun slime-load-asdf (filename)
  (slime-eval-with-transcript
   `(asdf::load-sysdef ,(file-name-sans-extension filename)
                       ,(slime-to-lisp-filename (expand-file-name filename)))))

(defun slime-custom-load-file ()
  (interactive)
  (unless buffer-file-name
    (error "Buffer %s is not associated with a file." (buffer-name)))
  (check-parens)
  (when (and (buffer-modified-p)
             (y-or-n-p (format "Save file %s? " (buffer-file-name))))
    (save-buffer))
  (let* ((type (file-name-extension buffer-file-name))
         (loader (cdr (assoc-string type slime-custom-file-loaders t))))
    (funcall (or loader
                 'slime-load-file)
             buffer-file-name)))

(define-key slime-mode-map (kbd "C-c C-l") 'slime-custom-load-file)

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
http://common-lisp.net/project/iolib

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20120506/d7391b5d/attachment.sig>


More information about the asdf-devel mailing list