summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-03-01 00:41:08 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-03-01 00:41:08 +0100
commit04652644b47528d0a3ab00c6475a6752e7a1dbb5 (patch)
tree564400b089a9a7f30bc32bdb2088c58e7ebeba54
parent7eb84295087a0d531e8694abf0ecc65c86ec5c34 (diff)
downloadgeiser-chez-04652644b47528d0a3ab00c6475a6752e7a1dbb5.tar.gz
geiser-chez-04652644b47528d0a3ab00c6475a6752e7a1dbb5.tar.bz2
Miscellaneous little fixes.
-rw-r--r--elisp/geiser-autodoc.el5
-rw-r--r--elisp/geiser-completion.el5
-rw-r--r--scheme/guile/geiser/introspection.scm24
3 files changed, 21 insertions, 13 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el
index 4c936cf..63eb3b9 100644
--- a/elisp/geiser-autodoc.el
+++ b/elisp/geiser-autodoc.el
@@ -88,7 +88,10 @@ when `geiser-autodoc-display-module-p' is on."
(let ((p (point))
(str (format "%s" (if (eq arg '\#:rest) "." arg))))
(insert str)
- (when (listp arg) (replace-regexp "(quote \\(.*\\))" "'\\1" nil p (point)))
+ (when (listp arg)
+ (save-excursion
+ (replace-regexp "(quote \\(.*\\))" "'\\1" nil p (point))
+ (replace-string "nil" "()" t p (point))))
(when (= current pos)
(put-text-property p (point) 'face 'geiser-font-lock-autodoc-current-arg))))
diff --git a/elisp/geiser-completion.el b/elisp/geiser-completion.el
index 7e1f642..3605ed5 100644
--- a/elisp/geiser-completion.el
+++ b/elisp/geiser-completion.el
@@ -150,7 +150,7 @@ terminates a current completion."
(delete-duplicates
(geiser-eval--send/result
`(:eval ((:ge completions) ,prefix
- (quote (:scm ,(geiser-syntax--get-partial-sexp))))))
+ (quote (:scm ,(or (geiser-syntax--get-partial-sexp) "()"))))))
:test 'string=))
(defsubst geiser-completion--module-list ()
@@ -161,8 +161,7 @@ terminates a current completion."
(defun geiser-completion--complete (prefix modules)
(let* ((symbols (if modules (geiser-completion--module-list)
- (append (geiser-syntax--local-bindings)
- (geiser-completion--symbol-list prefix))))
+ (geiser-completion--symbol-list prefix)))
(completions (all-completions prefix symbols))
(partial (try-completion prefix symbols))
(partial (if (eq partial t) prefix partial)))
diff --git a/scheme/guile/geiser/introspection.scm b/scheme/guile/geiser/introspection.scm
index c7b6de2..0a724f2 100644
--- a/scheme/guile/geiser/introspection.scm
+++ b/scheme/guile/geiser/introspection.scm
@@ -59,24 +59,30 @@
(cons 'position (find-position args form))
(cons 'module (symbol-module fun))))))
+(define (arglst args kind)
+ (let ((args (assq-ref args kind)))
+ (cond ((or (not args) (null? args)) '())
+ ((list? args) args)
+ (else (list args)))))
+
(define (signature fun args)
- (let ((req (assq-ref args 'required))
- (opt (assq-ref args 'optional))
- (key (assq-ref args 'keyword))
+ (let ((req (arglst args 'required))
+ (opt (arglst args 'optional))
+ (key (arglst args 'keyword))
(rest (assq-ref args 'rest)))
- (let ((sgn `(,fun ,@(or req '())
- ,@(if opt (cons #:optional opt) '())
- ,@(if key (cons #:key key) '()))))
+ (let ((sgn `(,fun ,@req
+ ,@(if (not (null? opt)) (cons #:opt opt) '())
+ ,@(if (not (null? key)) (cons #:key key) '()))))
(if rest `(,@sgn #:rest ,rest) sgn))))
(define (find-position args form)
(let* ((lf (length form))
(lf-1 (- lf 1)))
(if (= 1 lf) 0
- (let ((req (length (or (assq-ref args 'required) '())))
- (opt (length (or (assq-ref args 'optional) '())))
+ (let ((req (length (arglst args 'required)))
+ (opt (length (arglst args 'optional)))
(keys (map (lambda (k) (symbol->keyword (if (list? k) (car k) k)))
- (or (assq-ref args 'keyword) '())))
+ (arglst args 'keyword)))
(rest (assq-ref args 'rest)))
(cond ((<= lf (+ 1 req)) lf-1)
((<= lf (+ 1 req opt)) (if (> opt 0) lf lf-1))