summaryrefslogtreecommitdiff
path: root/scheme/guile
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-11 20:56:58 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-11 20:56:58 +0100
commitf7dc963dd7c6df1490ff792b6a45bd8f8ffea71e (patch)
treea8d491b7736f208e5b65e429f44d7c3e91926faa /scheme/guile
parent1a9da365fc52aa15300e03bb14aa4af5b9f47c6a (diff)
downloadgeiser-guile-f7dc963dd7c6df1490ff792b6a45bd8f8ffea71e.tar.gz
geiser-guile-f7dc963dd7c6df1490ff792b6a45bd8f8ffea71e.tar.bz2
Don't let (ice-9 history) confuse the evaluator.
Diffstat (limited to 'scheme/guile')
-rw-r--r--scheme/guile/geiser/introspection.scm31
1 files changed, 20 insertions, 11 deletions
diff --git a/scheme/guile/geiser/introspection.scm b/scheme/guile/geiser/introspection.scm
index eb5dc6c..6ac3f69 100644
--- a/scheme/guile/geiser/introspection.scm
+++ b/scheme/guile/geiser/introspection.scm
@@ -30,15 +30,17 @@
#:use-module (ice-9 session)
#:use-module (srfi srfi-1))
-(define (proc-args proc)
- (let ((proc (and (symbol? proc)
- (module-bound? (current-module) proc)
- (eval proc (current-module)))))
- (cond ((not proc) #f)
- ((program? proc) (program-args proc))
- ((procedure? proc) (procedure-args proc))
- ((macro? proc) (macro-args proc))
- (else #f))))
+(define (resolve-symbol sym)
+ (and (symbol? sym)
+ (module-bound? (current-module) sym)
+ (eval sym (current-module))))
+
+(define (obj-args obj)
+ (cond ((not obj) #f)
+ ((program? obj) (program-args obj))
+ ((procedure? obj) (procedure-args obj))
+ ((macro? obj) (macro-args obj))
+ (else #f)))
(define (program-args program)
(let* ((arity (program-arity program))
@@ -61,10 +63,9 @@
(and (not (null? env)) env))))
(define (macro-args macro)
- ;; check if return value is a procedure
(let ((prog (macro-transformer macro)))
(if prog
- (program-args prog)
+ (obj-args prog)
(format-args '(...) #f #f))))
(define (format-args args opt module)
@@ -72,9 +73,17 @@
(cons 'optional (or opt '()))
(cons 'module (if module (module-name module) '()))))
+(define (proc-args proc)
+ (obj-args (resolve-symbol proc)))
+
(define (completions prefix)
(sort! (map symbol->string
(apropos-internal (string-append "^" prefix)))
string<?))
+(define (proc-location proc)
+ (let ((prog (resolve-symbol proc)))
+ (and prog
+ (program-source ))))
+
;;; introspection.scm ends here