summaryrefslogtreecommitdiff
path: root/elisp/geiser-autodoc.el
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 /elisp/geiser-autodoc.el
parentadf746b37d1ffa35abe99eb3ae2b85902e8781ce (diff)
downloadgeiser-chez-e78b749e34c2f6e681f815d0b9b9dd3d32537c88.tar.gz
geiser-chez-e78b749e34c2f6e681f815d0b9b9dd3d32537c88.tar.bz2
Simpler handling of rest args in Emacs' side.
Diffstat (limited to 'elisp/geiser-autodoc.el')
-rw-r--r--elisp/geiser-autodoc.el33
1 files changed, 11 insertions, 22 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)))))