/
quicklisp.clj
42 lines (36 loc) · 1.18 KB
/
quicklisp.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(ns abclj.quicklisp
(:require [abclj.core :refer [with-cl with-cl->clj cl-load]])
(:import [java.io File])
)
(def ^:const ^:private quicklisp-url "https://beta.quicklisp.org/quicklisp.lisp")
(defn install-quicklisp
"Install quicklisp"
[]
(let [tmp-file (File/createTempFile "quicklisp" ".lisp")]
(->> quicklisp-url slurp (spit tmp-file))
(cl-load tmp-file)
(when-not (with-cl '(find-package 'ql))
(with-cl '(quicklisp-quickstart:install)))
:ok))
(defn load-quicklisp
"Loads quicklisp setup from the default folder, or specify a absolute path to setup.lisp"
([]
(with-cl `(load ~(str (System/getProperty "user.home")
"/quicklisp/setup.lisp"))))
([path]
(with-cl `(load ~path))))
(defn quickload
"Load libraries from quicklisp, accept n number of CL libraries."
[& pkgs]
(load-quicklisp)
(mapv #(with-cl->clj `(ql:quickload ~%)) pkgs))
(defn system-apropos
"Search a library in quicklisp"
[pkg]
(load-quicklisp)
(with-cl->clj `(ql:system-apropos ~pkg)))
(defn uninstall
"Delete a installed library, accept n number of CL libraries"
[& pkgs]
(load-quicklisp)
(mapv #(with-cl->clj `(ql:uninstall ~%)) pkgs))