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
commit55e11b2e6afcc7df4a8b8e7445a6d93bf21c587a (patch)
treed325376146c1fe6975227c23dd200eab9347a889 /elisp/geiser-impl.el
parentf0b21e7a636900729910f26dd9b0262cc27db998 (diff)
downloadgeiser-55e11b2e6afcc7df4a8b8e7445a6d93bf21c587a.tar.gz
geiser-55e11b2e6afcc7df4a8b8e7445a6d93bf21c587a.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)