summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-28 16:09:03 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-28 16:09:03 +0100
commitd70e9de59cfeae4fa8e76a48dbfe80e9d25e0d7c (patch)
tree32da929df5f7eda88da6e5ea926ca5d6a70710c9 /elisp
parente61a8e7c9068fab436b657ed42c1df2f73a8b6f3 (diff)
downloadgeiser-guile-d70e9de59cfeae4fa8e76a48dbfe80e9d25e0d7c.tar.gz
geiser-guile-d70e9de59cfeae4fa8e76a48dbfe80e9d25e0d7c.tar.bz2
Autodoc's argument display fixed
It was relying on symbol equality, and not dealing correctly with keyword arguments in this new external world. In the process, some cleanups to the scheme data display code.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-autodoc.el25
-rw-r--r--elisp/geiser-syntax.el25
2 files changed, 34 insertions, 16 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el
index 8222e0b..a338bb9 100644
--- a/elisp/geiser-autodoc.el
+++ b/elisp/geiser-autodoc.el
@@ -90,21 +90,11 @@ when `geiser-autodoc-display-module-p' is on."
(t '("..."))))
(defun geiser-autodoc--format-arg (a)
- (cond ((null a) "()")
- ((symbolp a) (format "%s" a))
- ((equal a "...") "...")
- ((stringp a) (format "%S" a))
- ((and (listp a) (keywordp (car a)))
+ (cond ((and (listp a) (geiser-syntax--keywordp (car a)))
(if (and (cdr a) (listp (cdr a)))
- (format "(#%s %s)" (car a) (geiser-autodoc--format-arg (cadr a)))
+ (format "(#%s %s)" (car a) (geiser-syntax--display (cadr a)))
(format "(#%s)" (car a))))
- ((and (listp a) (eq (car a) 'quote))
- (format "'%s" (geiser-autodoc--format-arg (cadr a))))
- ((listp a) (format "(%s)"
- (mapconcat 'geiser-autodoc--format-arg
- (geiser-autodoc--sanitize-args a)
- " ")))
- (t (format "%s" a))))
+ (t (geiser-syntax--display a))))
(defun geiser-autodoc--insert-arg-group (args current &optional pos)
(when args (insert " "))
@@ -115,9 +105,9 @@ when `geiser-autodoc-display-module-p' is on."
(numberp current)
(setq current (1+ current))
(= (1+ pos) current))
- (and (keywordp current)
+ (and (geiser-syntax--keywordp current)
(listp a)
- (eq current (car a))))
+ (geiser-syntax--symbol-eq current (car a))))
(put-text-property p (point)
'face 'geiser-font-lock-autodoc-current-arg)
(setq pos nil current nil)))
@@ -129,7 +119,10 @@ when `geiser-autodoc-display-module-p' is on."
(let ((cpos 1)
(reqs (cdr (assoc "required" args)))
(opts (mapcar (lambda (a)
- (if (and (symbolp a) (not (eq a '...))) (list a) a))
+ (if (and (symbolp a)
+ (not (equal (symbol-name a) "...")))
+ (list a)
+ a))
(cdr (assoc "optional" args))))
(keys (cdr (assoc "key" args))))
(setq cpos
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index ce5a7af..d6c6f91 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -235,6 +235,31 @@ implementation-specific entries for font-lock-keywords.")
(let ((geiser-syntax--read/buffer-limit (and (numberp boundary) boundary)))
(save-excursion (values (geiser-syntax--read) (point)))))
+(defun geiser-syntax--mapconcat (fun lst sep)
+ (cond ((null lst) "")
+ ((not (listp lst)) (format ".%s%s" sep (funcall fun lst)))
+ ((null (cdr lst)) (format "%s" (funcall fun (car lst))))
+ (t (format "%s%s%s"
+ (funcall fun (car lst))
+ sep
+ (geiser-syntax--mapconcat fun (cdr lst) sep)))))
+
+(defun geiser-syntax--display (a)
+ (cond ((null a) "()")
+ ((eq a :t) "#t")
+ ((eq a :f) "#f")
+ ((geiser-syntax--keywordp a) (format "#%s" a))
+ ((symbolp a) (format "%s" a))
+ ((equal a "...") "...")
+ ((stringp a) (format "%S" a))
+ ((and (listp a) (symbolp (car a))
+ (equal (symbol-name (car a)) "quote"))
+ (format "'%s" (geiser-syntax--display (cadr a))))
+ ((listp a)
+ (format "(%s)"
+ (geiser-syntax--mapconcat 'geiser-syntax--display a " ")))
+ (t (format "%s" a))))
+
;;; Code parsing: