diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-11-25 22:47:30 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-11-25 22:47:30 +0100 |
commit | d1535ee213ed9dc98a0d0897dc5525d70f4318c5 (patch) | |
tree | 4f3ca94815dedd0aefefabaf71cde5052f22f342 | |
parent | d2e44120a83f55e98598bd8d2c7e10f577b97324 (diff) | |
download | geiser-guile-d1535ee213ed9dc98a0d0897dc5525d70f4318c5.tar.gz geiser-guile-d1535ee213ed9dc98a0d0897dc5525d70f4318c5.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.
-rw-r--r-- | elisp/geiser-doc.el | 19 |
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 |