summaryrefslogtreecommitdiff
path: root/elisp/geiser-doc.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-16 00:46:31 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-16 00:46:31 +0100
commitfbc65dfc767da1dc3b28262eae041e9d303752c2 (patch)
tree47d8e715d9a608258e4bc8064504be801cd0dd17 /elisp/geiser-doc.el
parentecf460e9aca83a32bb1149ecd5b0238c7a5cb233 (diff)
downloadgeiser-guile-fbc65dfc767da1dc3b28262eae041e9d303752c2.tar.gz
geiser-guile-fbc65dfc767da1dc3b28262eae041e9d303752c2.tar.bz2
New command: module documentation.
Diffstat (limited to 'elisp/geiser-doc.el')
-rw-r--r--elisp/geiser-doc.el52
1 files changed, 52 insertions, 0 deletions
diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el
index 9dcb951..6bb1d10 100644
--- a/elisp/geiser-doc.el
+++ b/elisp/geiser-doc.el
@@ -26,10 +26,25 @@
(require 'geiser-completion)
(require 'geiser-eval)
+(require 'geiser-syntax)
(require 'geiser-popup)
+(require 'geiser-custom)
(require 'geiser-base)
+;;; Customization:
+
+(defgroup geiser-doc nil
+ "Options for documentation buffers."
+ :group 'geiser)
+
+(geiser-custom--defface doc-title
+ 'bold geiser-doc "article titles in documentation buffers")
+
+(geiser-custom--defface doc-link
+ 'link geiser-doc "links in documentation buffers")
+
+
;;; Documentation buffer:
(geiser-popup--define doc "*Geiser documentation*" fundamental-mode)
@@ -40,6 +55,26 @@
(defun geiser-doc--get-docstring (symbol)
(geiser-eval--send/result `(:gs ((:ge docstring) ',symbol))))
+(defun geiser-doc--get-module-children (module)
+ (geiser-eval--send/result `(:gs ((:ge module-children) (quote (:scm ,module))))))
+
+
+;;; Auxiliary functions:
+
+(defun geiser-doc--insert-title (title)
+ (let ((p (point)))
+ (insert title)
+ (put-text-property p (point) 'face 'geiser-font-lock-doc-title))
+ (newline))
+
+(defun geiser-doc--insert-list (title lst)
+ (when lst
+ (geiser-doc--insert-title title)
+ (newline)
+ (dolist (w lst)
+ (insert (format "\t- %s\n" w)))
+ (newline)))
+
;;; Commands:
@@ -58,6 +93,23 @@ With prefix argument, ask for symbol (with completion)."
(insert ds))
(geiser-doc--pop-to-buffer))))))
+(defun geiser-doc-module (module)
+ "Display information about a given module."
+ (interactive (list (geiser-completion--read-module)))
+ (let ((children (geiser-doc--get-module-children module)))
+ (if (not children)
+ (message "No info available for %s" module)
+ (geiser-doc--with-buffer
+ (erase-buffer)
+ (geiser-doc--insert-title (format "%s" module))
+ (newline)
+ (geiser-doc--insert-list "Procedures:" (cdr (assoc 'procs children)))
+ (geiser-doc--insert-list "Variables:" (cdr (assoc 'vars children)))
+ (geiser-doc--insert-list "Submodules:" (cdr (assoc 'modules children)))
+ (goto-char (point-min)))
+ (geiser-doc--pop-to-buffer))))
+
+
(provide 'geiser-doc)
;;; geiser-doc.el ends here