blob: fe0569eb9952fac2cdd21ab7bf79b0458995b54c (
plain)
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
43
44
45
46
47
48
49
50
|
(define (all-environment-exports environment prefix)
(if environment
(append (filter (lambda (identifier)
(if (string=? prefix "")
#t
(string-contains identifier prefix)))
(map symbol->string (env-exports environment)))
(all-environment-exports (env-parent environment) prefix))
'()))
(define (geiser:completions prefix . rest)
rest
(sort (all-environment-exports (current-environment) prefix)
string-ci<?))
(define (write-to-string form)
(let ((out (open-output-string)))
(write form out)
(get-output-string out)))
(define (geiser:eval module form . rest)
rest
(let ((output (open-output-string))
(result (if module
(let ((mod (module-env (find-module module))))
(eval form mod))
(eval form))))
(write `((result ,(write-to-string result))
(output . ,(get-output-string output))))
(values)))
(define (geiser:module-completions prefix . rest)
;; (available-modules) walks the directory tree and is too slow
(let ((modules (map car *modules*)))
(map write-to-string
(delete-duplicates
(filter (lambda (module)
(if (string=? "" prefix)
#t
(string-contains prefix (write-to-string module))))
modules)))))
(define (geiser:autodoc ids . rest)
'())
(define (geiser:no-values)
#f)
(define (geiser:newline)
#f)
|