diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-02-16 00:46:31 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-02-16 00:46:31 +0100 |
commit | dba34f8fdf4cf29703126abc498261ea410a9702 (patch) | |
tree | 0cff79320ee26788d525bb67b98be1dae9e34e5f /elisp/geiser-doc.el | |
parent | 90cab862978ec01dfb7fa2b06592d835400d798c (diff) | |
download | geiser-dba34f8fdf4cf29703126abc498261ea410a9702.tar.gz geiser-dba34f8fdf4cf29703126abc498261ea410a9702.tar.bz2 |
New command: module documentation.
Diffstat (limited to 'elisp/geiser-doc.el')
-rw-r--r-- | elisp/geiser-doc.el | 52 |
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 |