For a while I patched SLIME so that it would put FASLs in the same place as ASDF was told to put them. This keeps miscellaneous .fasls from cluttering up source directories.
The way it did this was to modify all the swank-${impl}.lisp files. Now I have been pleasantly surprised to see that the compile output-file has been very decently abstracted away.
It isn't perfect but it at least supports the customisations by Debian's common-lisp-controller::alternative-root-path-to-fasl-path.
Can I suggest this replacement for fasl-pathname? Or at least that a convenient way of allowing a similar customization be integrated? (Maybe allow *fasl-directory* to be a function?)
(defun fasl-pathname (input-file options) (cond ((getf options :fasl-directory) (let* ((str (getf options :fasl-directory)) (dir (filename-to-pathname str))) (assert (char= (aref str (1- (length str))) #/)) (compile-file-pathname input-file :output-file dir))) (*fasl-directory* (compile-file-pathname input-file :output-file *fasl-directory*)) (t (or (ignore-errors (first (asdf:output-files (make-instance 'asdf:compile-op) (make-instance 'asdf:cl-source-file :name (pathname-name (pathname input-file)) :parent (make-instance 'asdf:module :pathname nil :name "") :pathname nil)))) (compile-file-pathname input-file)))))
* John Fremlin [2009-03-09 05:46+0100] writes:
Can I suggest this replacement for fasl-pathname? Or at least that a convenient way of allowing a similar customization be integrated? (Maybe allow *fasl-directory* to be a function?)
I replaced *fasl-directory* with *fasl-pathname-function* which should give you complete control over the output filename.
Helmut.
Helmut Eller heller@common-lisp.net writes:
- John Fremlin [2009-03-09 05:46+0100] writes:
Can I suggest this replacement for fasl-pathname? Or at least that a convenient way of allowing a similar customization be integrated? (Maybe allow *fasl-directory* to be a function?)
I replaced *fasl-directory* with *fasl-pathname-function* which should give you complete control over the output filename.
Thanks!
Just in case anybody else wants to use the new system to put FASLs in the same directory as chosen by asdf (i.e. common-lisp-controller or asdf-binary-locations), here is my ~/.swank.lisp
(setf swank:*fasl-pathname-function* (lambda(input-file options) (declare (ignore options)) (or (ignore-errors (first (asdf:output-files (make-instance 'asdf:compile-op) (make-instance 'asdf:cl-source-file :name (pathname-name (pathname input-file)) :parent (make-instance 'asdf:module :pathname nil :name "") :pathname nil)))) (compile-file-pathname input-file))))
[...]