summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-04-27 21:28:51 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-04-27 21:28:51 +0200
commit11ed530d2fdf41ab91bf2166bb443ff89785576d (patch)
tree1cb59f0e0e98951a9d3889f7d0592b89fa5f4207 /elisp
parent43e8b54f94c054aa08e3d477ef4008631af13ce5 (diff)
downloadgeiser-11ed530d2fdf41ab91bf2166bb443ff89785576d.tar.gz
geiser-11ed530d2fdf41ab91bf2166bb443ff89785576d.tar.bz2
Support for external help functions (and application to PLT).
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-doc.el38
-rw-r--r--elisp/geiser-impl.el13
-rw-r--r--elisp/geiser-plt.el7
-rw-r--r--elisp/geiser.el8
4 files changed, 48 insertions, 18 deletions
diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el
index 60800f4..2fc9f69 100644
--- a/elisp/geiser-doc.el
+++ b/elisp/geiser-doc.el
@@ -157,6 +157,13 @@
;;; Commands:
+(make-variable-buffer-local
+ (defvar geiser-doc--external-help-function nil))
+
+(defun geiser-doc--external-help (symbol module)
+ (and geiser-doc--external-help-function
+ (funcall geiser-doc--external-help-function symbol module)))
+
(defun geiser-doc--get-docstring (symbol module)
(geiser-eval--send/result `(:eval ((:ge symbol-documentation) ',symbol) ,module)))
@@ -164,21 +171,22 @@
(geiser-eval--send/result `(:eval ((:ge module-children) (:module ,module)))))
(defun geiser-doc-symbol (symbol &optional module impl)
- (let* ((module (or module (geiser-eval--get-module)))
- (impl (or impl geiser-impl--implementation))
- (ds (geiser-doc--get-docstring symbol module)))
- (if (or (not ds) (not (listp ds)))
- (message "No documentation available for '%s'" symbol)
- (geiser-doc--with-buffer
- (erase-buffer)
- (geiser-doc--insert-title (cdr (assoc 'signature ds)))
- (newline)
- (insert (or (cdr (assoc 'docstring ds)) ""))
- (goto-line (point-min))
- (setq geiser-doc--buffer-link
- (geiser-doc--history-push
- (geiser-doc--make-link symbol module impl))))
- (geiser-doc--pop-to-buffer))))
+ (let ((module (or module (geiser-eval--get-module))))
+ (unless (geiser-doc--external-help symbol module)
+ (let ((impl (or impl geiser-impl--implementation))
+ (ds (geiser-doc--get-docstring symbol module)))
+ (if (or (not ds) (not (listp ds)))
+ (message "No documentation available for '%s'" symbol)
+ (geiser-doc--with-buffer
+ (erase-buffer)
+ (geiser-doc--insert-title (cdr (assoc 'signature ds)))
+ (newline)
+ (insert (or (cdr (assoc 'docstring ds)) ""))
+ (goto-line (point-min))
+ (setq geiser-doc--buffer-link
+ (geiser-doc--history-push
+ (geiser-doc--make-link symbol module impl))))
+ (geiser-doc--pop-to-buffer))))))
(defun geiser-doc-symbol-at-point (&optional arg)
"Get docstring for symbol at point.
diff --git a/elisp/geiser-impl.el b/elisp/geiser-impl.el
index 312ace9..ac6c2b9 100644
--- a/elisp/geiser-impl.el
+++ b/elisp/geiser-impl.el
@@ -27,6 +27,7 @@
(require 'geiser-eval)
(require 'geiser-base)
+(require 'geiser-doc)
;;; Customization:
@@ -120,10 +121,16 @@
(defsubst geiser-impl--geiser-procedure-function (impl)
(geiser-impl--sym impl "geiser-procedure"))
+(defsubst geiser-impl--external-help-function (impl)
+ (let ((f (geiser-impl--sym impl "external-help")))
+ (and (fboundp f) f)))
+
(defun geiser-impl--install-eval (impl)
(setq geiser-eval--get-module-function (geiser-impl--module-function impl))
(setq geiser-eval--geiser-procedure-function
- (geiser-impl--geiser-procedure-function impl)))
+ (geiser-impl--geiser-procedure-function impl))
+ (setq geiser-doc--external-help-function
+ (geiser-impl--external-help-function impl)))
;;; Evaluating Elisp in a given implementation context:
@@ -132,7 +139,9 @@
(let ((geiser-impl--implementation imp)
(geiser-eval--get-module-function (geiser-impl--module-function imp))
(geiser-eval--geiser-procedure-function
- (geiser-impl--geiser-procedure-function imp)))
+ (geiser-impl--geiser-procedure-function imp))
+ (geiser-doc--external-help-function
+ (geiser-impl--external-help-function imp)))
(funcall thunk)))
(put 'with--geiser-implementation 'lisp-indent-function 1)
diff --git a/elisp/geiser-plt.el b/elisp/geiser-plt.el
index aa9a901..77551c6 100644
--- a/elisp/geiser-plt.el
+++ b/elisp/geiser-plt.el
@@ -25,6 +25,7 @@
;;; Code:
(require 'geiser-impl)
+(require 'geiser-eval)
(require 'geiser-syntax)
(require 'geiser-custom)
(require 'geiser-base)
@@ -101,6 +102,12 @@ This function uses `geiser-plt-init-file' if it exists."
(t module)))
+;;; External help
+(defun geiser-plt-external-help (symbol module)
+ (message "Requesting help for '%s'..." symbol)
+ (geiser-eval--send/wait `(:eval (help ,symbol) 'geiser)))
+
+
;;; Trying to ascertain whether a buffer is mzscheme scheme:
(defun geiser-plt-guess ()
diff --git a/elisp/geiser.el b/elisp/geiser.el
index 4ccc1e1..146f421 100644
--- a/elisp/geiser.el
+++ b/elisp/geiser.el
@@ -60,6 +60,12 @@
(autoload 'switch-to-guile "geiser-guile.el"
"Start a Geiser Guile REPL, or switch to a running one." t)
+(autoload 'run-plt "geiser-plt.el"
+ "Start a Geiser MzScheme REPL, or switch to a running one." t)
+
+(autoload 'switch-to-plt "geiser-guile.el"
+ "Start a Geiser MzScheme REPL, or switch to a running one." t)
+
(autoload 'geiser-mode "geiser-mode.el"
"Minor mode adding Geiser REPL interaction to Scheme buffers." t)
@@ -102,6 +108,7 @@
(quote '(
geiser-mode
geiser-repl
+ geiser-impl
geiser-doc
geiser-xref
geiser-edit
@@ -109,7 +116,6 @@
geiser-autodoc
geiser-compile
geiser-debug
- geiser-impl
geiser-eval
geiser-connection
geiser-syntax