summaryrefslogtreecommitdiff
path: root/elisp/geiser-doc.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-25 22:47:30 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-25 22:47:30 +0100
commit544b9dfb82dcf81847d34a6c2d141f2020fe3198 (patch)
tree39cb9b1ebc1b6f18df630f4014dfb5585191646a /elisp/geiser-doc.el
parente6d361eaecb94316f77bcfda1dcaf4e4e27f6ada (diff)
downloadgeiser-544b9dfb82dcf81847d34a6c2d141f2020fe3198.tar.gz
geiser-544b9dfb82dcf81847d34a6c2d141f2020fe3198.tar.bz2
Link to symbol's module in doc browser
But i should really refactor this: module and value are (or can be) already available in the response coming from Scheme.
Diffstat (limited to 'elisp/geiser-doc.el')
-rw-r--r--elisp/geiser-doc.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el
index 2e8b4a2..5abcd3c 100644
--- a/elisp/geiser-doc.el
+++ b/elisp/geiser-doc.el
@@ -140,6 +140,14 @@ help (e.g. browse an HTML page) implementing this method.")
'action 'geiser-doc--button-action
'follow-link t)
+(defun geiser-doc--make-module-button (beg end module impl)
+ (let ((link (geiser-doc--make-link nil module impl))
+ (help (format "Help for module %s" module)))
+ (make-text-button beg end :type 'geiser-doc--button
+ 'face 'geiser-font-lock-doc-link
+ 'geiser-link link
+ 'help-echo help)))
+
(defun geiser-doc--insert-button (target module impl &optional sign)
(let ((link (geiser-doc--make-link target module impl))
(text (format "%s" (or (and sign (geiser-autodoc--str* sign))
@@ -267,6 +275,16 @@ help (e.g. browse an HTML page) implementing this method.")
(geiser-eval--send/result
`(:eval (:ge module-exports '(:module ,module)) :f)))
+(defun geiser-doc--buttonize-module (impl)
+ (save-excursion
+ (goto-char (point-min))
+ (when (re-search-forward "in module \\([^.\n]+\\)\\." nil t)
+ (geiser-doc--make-module-button (match-beginning 1)
+ (match-end 1)
+ (geiser-doc--module (match-string 1)
+ impl)
+ impl))))
+
(defun geiser-doc-symbol (symbol &optional module impl)
(let* ((impl (or impl geiser-impl--implementation))
(module (geiser-doc--module (or module (geiser-eval--get-module))
@@ -281,6 +299,7 @@ help (e.g. browse an HTML page) implementing this method.")
(cdr (assoc 'signature ds))))
(newline)
(insert (or (cdr (assoc 'docstring ds)) ""))
+ (geiser-doc--buttonize-module impl)
(setq geiser-doc--buffer-link
(geiser-doc--history-push (geiser-doc--make-link symbol
module