From 09de995336a20bbc986b77f5f4ce417225842b64 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 26 Sep 2009 21:44:21 +0200 Subject: Multiple arity display, used by PLT backend (case-lambda). --- elisp/geiser-autodoc.el | 60 +++++++++++++++++++++++++++---------------------- elisp/geiser-doc.el | 2 +- 2 files changed, 34 insertions(+), 28 deletions(-) (limited to 'elisp') 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)) "")) -- cgit v1.2.3