diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-02-14 14:07:08 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-02-14 14:07:08 +0100 |
commit | 13d84e514446438f0115585f3a14e36f535e2225 (patch) | |
tree | aca32e9200a533a643da29fe7e909a7e7faec1d8 | |
parent | 9cfc4087722156e3cb53e425b2f81fd118844d14 (diff) | |
download | geiser-guile-13d84e514446438f0115585f3a14e36f535e2225.tar.gz geiser-guile-13d84e514446438f0115585f3a14e36f535e2225.tar.bz2 |
Small autodoc fixes.
-rw-r--r-- | elisp/geiser-autodoc.el | 24 | ||||
-rw-r--r-- | scheme/guile/geiser/introspection.scm | 16 |
2 files changed, 22 insertions, 18 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el index 4f4a43a..f8e682b 100644 --- a/elisp/geiser-autodoc.el +++ b/elisp/geiser-autodoc.el @@ -71,25 +71,27 @@ when `geiser-autodoc-display-module-p' is on." (defvar geiser-autodoc--last-funs nil)) (defun geiser-autodoc--function-args (funs) - (let ((pr (and (eq (car geiser-autodoc--last) (caar funs)) (car funs)))) - (if pr (geiser-autodoc--fun-args-str (car pr) - (cdr geiser-autodoc--last) - (cdr pr)) - (setq geiser-autodoc--last-funs funs) - (geiser-eval--send `(:gs ((:ge arguments) ,@(mapcar (lambda (f) (list 'quote (car f))) - funs))) - 'geiser-autodoc--function-args-cont) - ""))) + (when funs + (let ((pr (and (eq (car geiser-autodoc--last) (caar funs)) (car funs)))) + (if pr (geiser-autodoc--fun-args-str (car pr) + (cdr geiser-autodoc--last) + (cdr pr)) + (setq geiser-autodoc--last-funs funs) + (geiser-eval--send `(:gs ((:ge arguments) ,@(mapcar (lambda (f) (list 'quote (car f))) + funs))) + 'geiser-autodoc--function-args-cont) + "")))) (defun geiser-autodoc--function-args-cont (ret) (let ((result (geiser-eval--retort-result ret))) - (when (listp result) + (when (and result (listp result)) (setq geiser-autodoc--last result) (eldoc-message (geiser-autodoc--fun-args-str (car result) (cdr result) (or (cdr (assoc (car result) - geiser-autodoc--last-funs)))))))) + geiser-autodoc--last-funs)) + 0)))))) (defun geiser-autodoc--insert (sym current pos) (let ((str (format "%s" sym))) diff --git a/scheme/guile/geiser/introspection.scm b/scheme/guile/geiser/introspection.scm index a158d66..cd48740 100644 --- a/scheme/guile/geiser/introspection.scm +++ b/scheme/guile/geiser/introspection.scm @@ -25,19 +25,19 @@ ;;; Code: (define-module (geiser introspection) - #:export (arguments completions symbol-location) + #:export (arguments completions symbol-location docstring) #:use-module (system vm program) #:use-module (ice-9 session) #:use-module (srfi srfi-1)) (define (arguments sym . syms) (let loop ((sym sym) (syms syms)) - (cond ((obj-args (resolve-symbol sym)) => (lambda (args) (cons sym args))) + (cond ((obj-args (symbol->obj sym)) => (lambda (args) (cons sym args))) ((null? syms) #f) (else (loop (car syms) (cdr syms)))))) -(define (resolve-symbol sym) - (module-ref (current-module) sym)) +(define (symbol->obj sym) + (and (symbol? sym) (module-ref (current-module) sym))) (define (obj-args obj) (cond ((not obj) #f) @@ -80,9 +80,11 @@ (define (procedure-args-from-source name src) (let ((formals (cadr src))) (cond ((list? formals) (format-args formals #f (symbol-module name))) - ((pair? formals) (format-args (car formals) - (cdr formals) - (symbol-module name))) + ((pair? formals) (let ((req (car formals)) + (opt (cdr formals))) + (format-args (if (list? req) req (list req)) + opt + (symbol-module name)))) (else #f)))) (define (macro-args macro) |