summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-28 04:35:45 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-28 04:35:45 +0100
commite78b749e34c2f6e681f815d0b9b9dd3d32537c88 (patch)
treea3b9ce9f95e20d5081b5f2f83c6a6cb2300b485d
parentadf746b37d1ffa35abe99eb3ae2b85902e8781ce (diff)
downloadgeiser-chez-e78b749e34c2f6e681f815d0b9b9dd3d32537c88.tar.gz
geiser-chez-e78b749e34c2f6e681f815d0b9b9dd3d32537c88.tar.bz2
Simpler handling of rest args in Emacs' side.
-rw-r--r--elisp/geiser-autodoc.el33
-rw-r--r--elisp/geiser-doc.el11
-rw-r--r--elisp/geiser-repl.el4
-rw-r--r--scheme/guile/geiser/introspection.scm4
4 files changed, 23 insertions, 29 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el
index 3577193..5d5befa 100644
--- a/elisp/geiser-autodoc.el
+++ b/elisp/geiser-autodoc.el
@@ -85,23 +85,13 @@ when `geiser-autodoc-display-module-p' is on."
(cdr geiser-autodoc--last))))))
(defun geiser-autodoc--insert-arg (arg current pos)
- (let ((str (format "%s" arg)))
+ (let ((str (format "%s" (if (eq arg '\#:rest) "." arg))))
(when (= current pos)
(put-text-property 0 (length str)
'face 'geiser-font-lock-autodoc-current-arg
str))
(insert str)))
-(defun geiser-autodoc--insert-args (arg args current pos)
- (when arg
- (geiser-autodoc--insert-arg arg current pos)
- (cond ((null args) (insert ")"))
- ((listp args)
- (insert " ")
- (geiser-autodoc--insert-args (car args) (cdr args) (1+ current) pos))
- (t (insert " . ")
- (geiser-autodoc--insert-args args nil (1+ current) pos)))))
-
(defsubst geiser-autodoc--proc-name (proc module)
(let ((str (if module
(format geiser-autodoc-procedure-name-format module proc)
@@ -116,17 +106,16 @@ when `geiser-autodoc-display-module-p' is on."
(save-current-buffer
(set-buffer (geiser-syntax--font-lock-buffer))
(erase-buffer)
- (let ((proc (car signature))
- (args (cdr signature)))
- (insert (format "(%s " (geiser-autodoc--proc-name proc module)))
- (if args
- (if (listp args)
- (geiser-autodoc--insert-args (car args) (cdr args) 1 pos)
- (insert ". ")
- (geiser-autodoc--insert-arg args 1 1)
- (insert ")"))
- (delete-char -1)
- (insert ")"))
+ (let* ((proc (car signature))
+ (args (cdr signature))
+ (current 1)
+ (pos (if (> pos (length args)) (length args) pos)))
+ (insert (format "(%s" (geiser-autodoc--proc-name proc module)))
+ (dolist (a args)
+ (insert " ")
+ (geiser-autodoc--insert-arg a current pos)
+ (setq current (1+ current)))
+ (insert ")")
(buffer-string)))))
diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el
index 4e65b67..6d2eb40 100644
--- a/elisp/geiser-doc.el
+++ b/elisp/geiser-doc.el
@@ -125,9 +125,14 @@
(defun geiser-doc--insert-title (title)
(let ((p (point)))
- (insert (format "%s" title))
- (put-text-property p (point) 'face 'geiser-font-lock-doc-title))
- (newline))
+ (if (not (listp title))
+ (insert (format "%s" title))
+ (insert "(" (format "%s" (car title)))
+ (dolist (a (cdr title))
+ (insert " " (if (eq a '\#:rest) "." (format "%s" a))))
+ (insert ")"))
+ (put-text-property p (point) 'face 'geiser-font-lock-doc-title)
+ (newline)))
(defun geiser-doc--insert-list (title lst module)
(when lst
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index e4617e1..430dc44 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -83,7 +83,7 @@ REPL buffer."
:group 'geiser-repl)
-;;; REPL History:
+;;; REPL history:
(defun geiser-repl--sentinel (proc event)
(when (string= event "finished\n")
@@ -91,7 +91,7 @@ REPL buffer."
(let ((comint-input-ring-file-name geiser-repl-history-filename))
(comint-write-input-ring)
(when (buffer-name (current-buffer))
- (insert "\nIt's been nice to interact with you!\n")
+ (insert "\nIt's been nice interacting with you!\n")
(insert "Press C-cz to bring me back.\n" ))))))
(defun geiser-repl--input-filter (str)
diff --git a/scheme/guile/geiser/introspection.scm b/scheme/guile/geiser/introspection.scm
index 0394926..7e468e7 100644
--- a/scheme/guile/geiser/introspection.scm
+++ b/scheme/guile/geiser/introspection.scm
@@ -67,7 +67,7 @@
(let ((sgn `(,fun ,@(or req '())
,@(if opt (cons #:optional opt) '())
,@(if key (cons #:key key) '()))))
- (if rest `(,@sgn . ,rest) sgn))))
+ (if rest `(,@sgn #:rest ,rest) sgn))))
(define (find-position args form)
(let* ((lf (length form))
@@ -89,7 +89,7 @@
(else (+ 1 req
(if (> opt 0) (+ 1 opt) 0)
(if (null? keys) 0 (+ 1 (length keys)))
- (if rest 1 0))))))))
+ (if rest 2 0))))))))
(define (symbol->obj sym)
(and (symbol? sym)