summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elisp/geiser-connection.el1
-rw-r--r--elisp/geiser-syntax.el5
-rw-r--r--scheme/guile/geiser/introspection.scm31
3 files changed, 24 insertions, 13 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index c18e7b2..7a73adc 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -160,7 +160,6 @@
(defun geiser-con--comint-buffer-form ()
(with-current-buffer (geiser-con--comint-buffer)
(geiser-syntax--prepare-scheme-for-elisp-reader)
- (goto-char (point-min))
(condition-case nil
(let ((form (read (current-buffer))))
(if (listp form) form (error)))
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index 32b28bb..2199cc5 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -93,7 +93,10 @@
(goto-char (point-min))
(while (re-search-forward "#(" nil t) (replace-match "(vector "))
(goto-char (point-min))
- (while (re-search-forward "#" nil t) (replace-match "\\\\#")))
+ (while (re-search-forward "#" nil t) (replace-match "\\\\#"))
+ (goto-char (point-min))
+ (skip-syntax-forward "^("))
+)
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