summaryrefslogtreecommitdiff
path: root/scheme
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-07-28 01:08:25 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-07-28 01:08:25 +0200
commit32f9cb274bc9abc16449d2da50df537c82cc7775 (patch)
tree70bdaee986544bb0ea5978bc33cbed47957fc003 /scheme
parent235543503d09a52a513054ed75ac2506b7ce87bf (diff)
downloadgeiser-chez-32f9cb274bc9abc16449d2da50df537c82cc7775.tar.gz
geiser-chez-32f9cb274bc9abc16449d2da50df537c82cc7775.tar.bz2
Displaying variable values in autodoc.
Diffstat (limited to 'scheme')
-rw-r--r--scheme/guile/geiser/doc.scm7
-rw-r--r--scheme/racket/geiser/autodoc.rkt9
2 files changed, 11 insertions, 5 deletions
diff --git a/scheme/guile/geiser/doc.scm b/scheme/guile/geiser/doc.scm
index 8c00e22..0d6b451 100644
--- a/scheme/guile/geiser/doc.scm
+++ b/scheme/guile/geiser/doc.scm
@@ -49,8 +49,11 @@
,@(let ((rest (assq-ref as 'rest)))
(if rest (list "...") '())))
(key ,@(arglst as 'keyword))))
- (let ((args-list (map mkargs (if (list? args-list) args-list '()))))
- (list id (cons 'args args-list))))
+ (let* ((args-list (map mkargs (if (list? args-list) args-list '())))
+ (value (if (null? args-list)
+ (format #f "~s" (symbol->object id))
+ "")))
+ (list id (cons 'args args-list) (cons 'value value))))
(define default-macro-args '(((required ...))))
diff --git a/scheme/racket/geiser/autodoc.rkt b/scheme/racket/geiser/autodoc.rkt
index 9eb732d..9eaec15 100644
--- a/scheme/racket/geiser/autodoc.rkt
+++ b/scheme/racket/geiser/autodoc.rkt
@@ -26,17 +26,20 @@
(map (lambda (id) (or (autodoc* id) (list id))) ids)))
(define (autodoc* id)
+ (define (val)
+ (with-handlers ([exn? (const "")])
+ (format "~.a" (namespace-variable-value id))))
(and
(symbol? id)
(let* ([loc (symbol-location* id)]
[name (car loc)]
[path (cdr loc)]
- [sgns (and path (find-signatures path name id))]
- [sgns (and sgns (if (list? sgns) sgns '()))])
+ [sgns (and path (find-signatures path name id))])
(and sgns
`(,id
(name . ,name)
- (args ,@(map format-signature sgns))
+ (value . ,(if (list? sgns) "" (val)))
+ (args ,@(if (list? sgns) (map format-signature sgns) '()))
(module . ,(module-path-name->name path)))))))
(define (format-signature sign)