diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-09-26 21:44:21 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-09-26 21:44:21 +0200 |
commit | f2f267955c46d110da4c75a5972f021a2c715a6c (patch) | |
tree | 642ee19a130a8d87b22e284643ca7d4a6d5e5ef9 /elisp | |
parent | f67ef229256de7406666dd5ffe14c229bf0b2045 (diff) | |
download | geiser-chez-f2f267955c46d110da4c75a5972f021a2c715a6c.tar.gz geiser-chez-f2f267955c46d110da4c75a5972f021a2c715a6c.tar.bz2 |
Multiple arity display, used by PLT backend (case-lambda).
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-autodoc.el | 60 | ||||
-rw-r--r-- | elisp/geiser-doc.el | 2 |
2 files changed, 34 insertions, 28 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el index 5d8e35c..db3b351 100644 --- a/elisp/geiser-autodoc.el +++ b/elisp/geiser-autodoc.el @@ -78,7 +78,7 @@ when `geiser-autodoc-display-module-p' is on." cached)))))))) geiser-autodoc--cached-signatures))) -(defun geiser-autodoc--insert-args (args current &optional pos) +(defun geiser-autodoc--insert-arg-group (args current &optional pos) (dolist (a args) (let ((p (point))) (insert (format "%s" a)) @@ -95,6 +95,26 @@ when `geiser-autodoc-display-module-p' is on." (when args (backward-char)) current) +(defun geiser-autodoc--insert-args (args pos prev) + (let ((cpos 1) + (reqs (cdr (assoc 'required args))) + (opts (cdr (assoc 'optional args))) + (keys (cdr (assoc 'key args)))) + (when reqs + (insert " ") + (setq cpos + (geiser-autodoc--insert-arg-group reqs + cpos + (and (not (zerop pos)) pos)))) + (when opts + (insert " [") + (setq cpos (geiser-autodoc--insert-arg-group opts cpos pos)) + (when keys + (insert " [") + (geiser-autodoc--insert-arg-group keys prev nil) + (insert "]")) + (insert "]")))) + (defsubst geiser-autodoc--proc-name (proc module) (let ((str (if module (format geiser-autodoc-procedure-name-format module proc) @@ -106,32 +126,18 @@ when `geiser-autodoc-display-module-p' is on." (args (cdr (assoc 'args signature))) (module (cdr (assoc 'module signature)))) (if (not args) (geiser-autodoc--proc-name proc module) - (let ((cpos 1) - (pos (or (cadr desc) 0)) - (prev (caddr desc)) - (reqs (cdr (assoc 'required args))) - (opts (cdr (assoc 'optional args))) - (keys (cdr (assoc 'key args)))) - (save-current-buffer - (set-buffer (geiser-syntax--font-lock-buffer)) - (erase-buffer) - (insert (format "(%s" (geiser-autodoc--proc-name proc module))) - (when reqs - (insert " ") - (setq cpos - (geiser-autodoc--insert-args reqs - cpos - (and (not (zerop pos)) pos)))) - (when opts - (insert " [") - (setq cpos (geiser-autodoc--insert-args opts cpos pos)) - (when keys - (insert " [") - (geiser-autodoc--insert-args keys prev nil) - (insert "]")) - (insert "]")) - (insert ")") - (buffer-string)))))) + (save-current-buffer + (set-buffer (geiser-syntax--font-lock-buffer)) + (erase-buffer) + (insert (format "(%s" (geiser-autodoc--proc-name proc module))) + (let ((pos (or (cadr desc) 0)) + (prev (caddr desc))) + (dolist (a args) + (geiser-autodoc--insert-args a pos prev) + (insert " |"))) + (delete-char -2) + (insert ")") + (buffer-string))))) (defun geiser-autodoc--autodoc (path &optional keep-cached) (let ((signs (geiser-autodoc--get-signatures (mapcar 'car path) keep-cached)) diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el index b7ed4aa..d78c837 100644 --- a/elisp/geiser-doc.el +++ b/elisp/geiser-doc.el @@ -167,7 +167,7 @@ help (e.g. browse an HTML page) implementing this method.") (message "No documentation available for '%s'" symbol) (geiser-doc--with-buffer (erase-buffer) - (geiser-doc--insert-title (geiser-autodoc--str (list (format "%s" symbol) 0) + (geiser-doc--insert-title (geiser-autodoc--str (list (symbol-name symbol) 0) (cdr (assoc 'signature ds)))) (newline) (insert (or (cdr (assoc 'docstring ds)) "")) |