summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-12-20 02:27:08 +0000
committerjao <jao@gnu.org>2021-12-20 02:27:08 +0000
commitc5f6a8ac9ebdce93d4b551342accd2c85c4f7030 (patch)
tree8b96f78b749fc777ef90f5c5aade98ae5dd44e3b
parentba290b4fa57cf11667bfb60adf617c5c1bd6c26f (diff)
downloadgeiser-0.20.tar.gz
geiser-0.20.tar.bz2
geiser-doc: new keybindings s/h mocking help buffer's0.20
-rw-r--r--elisp/geiser-doc.el36
1 files changed, 23 insertions, 13 deletions
diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el
index 44a06ba..b160bd8 100644
--- a/elisp/geiser-doc.el
+++ b/elisp/geiser-doc.el
@@ -163,20 +163,28 @@ help (e.g. browse an HTML page) implementing this method.")
'geiser-link link
'help-echo help)))
+(defun geiser-doc-goto-source ()
+ "Go to the definition of this item."
+ (interactive)
+ (when-let (link geiser-doc--buffer-link)
+ (with--geiser-implementation (geiser-doc--link-impl link)
+ (if-let (target (geiser-doc--link-target link))
+ (geiser-edit-symbol target nil (point-marker))
+ (geiser-edit-module (geiser-doc--link-module link))))))
+
+(defun geiser-doc-goto-manual ()
+ "Go to the manual for this item."
+ (interactive)
+ (when-let (link geiser-doc--buffer-link)
+ (let ((tm (geiser-doc--link-target link))
+ (mod (geiser-doc--link-module link))
+ (impl (geiser-doc--link-impl link)))
+ (geiser-doc--external-help impl (or tm mod) mod))))
+
(defun geiser-doc--xbutton-action (button)
- (when geiser-doc--buffer-link
- (let ((kind (or (button-get button 'x-kind) 'source))
- (target (geiser-doc--link-target geiser-doc--buffer-link))
- (module (geiser-doc--link-module geiser-doc--buffer-link))
- (impl (geiser-doc--link-impl geiser-doc--buffer-link)))
- (with--geiser-implementation impl
- (cond ((eq kind 'source)
- (if target (geiser-edit-symbol target nil (point-marker))
- (geiser-edit-module module)))
- ((eq kind 'manual)
- (geiser-doc--external-help impl
- (or target module)
- module)))))))
+ (let ((k (button-get button 'x-kind)))
+ (cond ((eq 'source k) (geiser-doc-goto-source))
+ ((eq 'manual k) (geiser-doc-goto-manual)))))
(define-button-type 'geiser-doc--xbutton
'action 'geiser-doc--xbutton-action
@@ -305,6 +313,8 @@ help (e.g. browse an HTML page) implementing this method.")
--
("Edit symbol" ("." "\M-.") geiser-doc-edit-symbol-at-point
:enable (geiser--symbol-at-point))
+ ("View source" ("s") geiser-doc-goto-source)
+ ("View manual" ("m" "h") geiser-doc-goto-manual)
--
("Kill item" "k" geiser-doc-kill-page "Kill this page")
("Clear history" "c" geiser-doc-clean-history)