summaryrefslogtreecommitdiff
path: root/scheme
diff options
context:
space:
mode:
authorDan Leslie <dan@ironoxide.ca>2018-11-11 22:05:18 -0800
committerJose Antonio Ortega Ruiz <jao@gnu.org>2018-11-12 17:46:57 +0000
commit433fee19d173223b204b3ec0f2b59b2e34b53d6f (patch)
treeb67d52a71d9bbfae4ed6601a6b776134d3786f0e /scheme
parent149cf613ee81f40f678b08f1c451ad256d843c94 (diff)
downloadgeiser-guile-433fee19d173223b204b3ec0f2b59b2e34b53d6f.tar.gz
geiser-guile-433fee19d173223b204b3ec0f2b59b2e34b53d6f.tar.bz2
Much faster completions for Chicken 5; less errors in the log.
Diffstat (limited to 'scheme')
-rw-r--r--scheme/chicken/geiser/chicken5.scm35
1 files changed, 18 insertions, 17 deletions
diff --git a/scheme/chicken/geiser/chicken5.scm b/scheme/chicken/geiser/chicken5.scm
index 4ef110e..6c8ceae 100644
--- a/scheme/chicken/geiser/chicken5.scm
+++ b/scheme/chicken/geiser/chicken5.scm
@@ -140,15 +140,13 @@
(write-to-log out-form))
(newline)))
-
- (define (read* str)
- (with-input-from-string str (lambda () (read))))
(define (eval* str)
- (cond
- ((symbol? str) (eval str))
- ((string? str) (eval (read* str)))
- (else #f)))
+ (handle-exceptions exn #f
+ (with-all-output-to-string
+ (eval
+ (with-input-from-string (->string str)
+ (lambda () (read)))))))
(define (fmt node)
(let* ((mod (cadr node))
@@ -160,7 +158,9 @@
`(,sym ("args" (("required" <macro>)
("optional" ...)
("key")))
- ("module")))
+ ,(if (and mod)
+ (cons "module" mod)
+ (list "module"))))
((or (equal? 'variable type)
(equal? 'constant type))
`(,sym ("value" . ,(eval* sym))))
@@ -197,7 +197,9 @@
`(,sym ("args" (("required" ,@reqs)
("optional" ,@opts)
("key" ,@keys)))
- ("module")))))))
+ ,(if (and mod)
+ (cons "module" mod)
+ (list "module"))))))))
;; Builds a signature list from an identifier
(define (find-signatures sym)
@@ -277,14 +279,13 @@
(define (geiser-autodoc ids . rest)
(cond
- ((null? ids) '())
- ((not (list? ids))
- (geiser-autodoc (list ids)))
- (else
- (let ((details (find-signatures (car ids))))
- (if (null? details)
- (geiser-autodoc (cdr ids))
- details)))))
+ ((null? ids) #f)
+ ((symbol? ids)
+ (find-signatures ids))
+ ((list? ids)
+ (let ((first (find-signatures (car ids))))
+ (if first first (geiser-autodoc (cdr ids)))))
+ (else #f)))
(define (geiser-object-signature name object . rest)
(let* ((sig (geiser-autodoc `(,name))))