summaryrefslogtreecommitdiff
path: root/elisp/geiser-impl.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-14 22:01:48 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-14 22:01:48 +0100
commit6d64c4f1a19862d88d0429cd60f42c811e4007a6 (patch)
treef16014d988a486980fb191701c856142476af9b0 /elisp/geiser-impl.el
parente061494c211c86001f8391f331e2a9f3df0d17ae (diff)
downloadgeiser-guile-6d64c4f1a19862d88d0429cd60f42c811e4007a6.tar.gz
geiser-guile-6d64c4f1a19862d88d0429cd60f42c811e4007a6.tar.bz2
geiser-implementation-help, for Geiser hackers
This interactive command will list all method needed to define a new Scheme implementation in Geiser, together with their callers and doc strings. Although i know very few additional schemes meta-dynamic enough to be supported by Geiser (actually, just one: scheme48), one never knows (there was a time when i thought that PLT Scheme wasn't in the list).
Diffstat (limited to 'elisp/geiser-impl.el')
-rw-r--r--elisp/geiser-impl.el39
1 files changed, 32 insertions, 7 deletions
diff --git a/elisp/geiser-impl.el b/elisp/geiser-impl.el
index 8c55ab4..5c09d51 100644
--- a/elisp/geiser-impl.el
+++ b/elisp/geiser-impl.el
@@ -82,24 +82,49 @@ determine its scheme flavour."
(let ((fun (geiser-impl--method method impl)))
(when (functionp fun) (apply fun args))))
-(defun geiser-impl--method-doc (method doc)
- (push (cons method doc) geiser-impl--method-docs))
+(defun geiser-impl--method-doc (method doc user)
+ (let* ((user (if user (format " Used via `%s'." user) ""))
+ (extra-doc (format "%s%s" doc user)))
+ (add-to-list 'geiser-impl--method-docs (cons method extra-doc))
+ (put method 'function-documentation doc)))
+
+(defun geiser-implementation-help ()
+ "Shows a list of implementation methods, with descriptions."
+ (interactive)
+ (with-current-buffer (get-buffer-create "* Geiser implementation help*")
+ (setq buffer-read-only nil)
+ (delete-region (point-min) (point-max))
+ (insert "Methods used to define an implementation:\n\n")
+ (let ((ms (sort (copy-list geiser-impl--method-docs)
+ (lambda (a b) (string< (symbol-name (car a))
+ (symbol-name (car b)))))))
+ (dolist (m ms)
+ (geiser--insert-with-face (format "%s: " (car m)) 'bold)
+ (insert (cdr m))
+ (fill-paragraph)
+ (insert "\n\n")))
+ (goto-char (point-min))
+ (unless (eq major-mode 'help-mode) (help-mode))
+ (help-make-xrefs)
+ (setq buffer-read-only t)
+ (pop-to-buffer (current-buffer))))
(defun geiser-impl--register-local-method (var-name method fallback doc)
(add-to-list 'geiser-impl--local-methods (list var-name method fallback))
- (geiser-impl--method-doc method doc))
+ (geiser-impl--method-doc method doc var-name)
+ (put var-name 'function-documentation doc))
(defun geiser-impl--register-local-variable (var-name method fallback doc)
(add-to-list 'geiser-impl--local-variables (list var-name method fallback))
- (geiser-impl--method-doc method doc))
+ (geiser-impl--method-doc method doc var-name)
+ (put var-name 'variable-documentation doc))
(defmacro geiser-impl--define-caller (fun-name method arglist doc)
- (let ((m (make-symbol "method-candidate"))
- (impl (make-symbol "implementation-name")))
+ (let ((impl (make-symbol "implementation-name")))
`(progn
(defun ,fun-name ,(cons impl arglist) ,doc
(geiser-impl--call-method ',method ,impl ,@arglist))
- (geiser-impl--method-doc ',method ,doc))))
+ (geiser-impl--method-doc ',method ,doc ',fun-name))))
(put 'geiser-impl--define-caller 'lisp-indent-function 3)
(defun geiser-impl--register (file impl methods)