(defvar *loadable-packages* nil "Cached list of ASDF loadable packages. Set to NIL to recompute.") ;; This is an horrible hack. I wish we could ask ASDF and Quicklisp. (defun loadable-packages (&key as-strings) "List of potentially ASDF loadable packages." (labels ((place-dir (p) "Resolve place into a directory." (with-output-to-string (s) (if (listp p) (loop :for e :in p :if (eq e :home) :do (write-string (namestring (user-homedir-pathname)) s) :else :do (write-string e s)) (write-string p s))))) (or (and *loadable-packages* (or (and (and as-strings (stringp (car *loadable-packages*))) *loadable-packages*) (and (not as-strings) (keywordp (car *loadable-packages*)) *loadable-packages*))) (setf *loadable-packages* (with-spin () (let ((s-dirs (loop :for e in asdf:*source-registry-parameter* :if (and (listp e) (eq (car e) :directory)) :collect (place-dir (cadr e)))) (c-dirs (mapcar #'namestring asdf:*central-registry*))) (append (loop :for d :in (concatenate 'list s-dirs c-dirs) :append (loop :with base :and result :for f :in (glob (path-append d "*.[Aa][Ss][Dd]")) :do (spin) :collect (progn (setf base (path-file-name f) result (subseq base 0 (- (length base) 4))) (if as-strings result (keywordify result))))) #+quicklisp ;; Quicklisp (loop :for d :in (ql-dist:all-dists) :append (loop :for s :in (ql-dist:installed-systems d) :do (spin) :collect (if as-strings (ql-dist:name s) (keywordify (ql-dist:name s)))))))))))) (defvar *quickloadable-systems* nil "Cached list of Quickload loadable systems. Set to NIL to recompute.") (defun quickloadable-systems (&key as-strings) "List of packages the quickload can maybe load, if it can download them." (or *quickloadable-systems* #+quicklisp (setf *quickloadable-systems* (with-spin () (loop :for d :in (ql-dist:all-dists) :append (loop :for s :in (ql-dist:provided-systems d) :do (spin) :collect (if as-strings (string-downcase (ql-dist:name s)) (keywordify (ql-dist:name s)))))))))