summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-24 23:46:33 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-24 23:46:33 +0100
commitba1b1d6c588665f90d646201cefa3753409693ee (patch)
tree48d0fa4772b37ff7cc7b38cbcaf51e9e61c58ab0 /elisp
parent9d6f58752e0de247eb165a0052116ec97a1afb22 (diff)
downloadgeiser-ba1b1d6c588665f90d646201cefa3753409693ee.tar.gz
geiser-ba1b1d6c588665f90d646201cefa3753409693ee.tar.bz2
Doc browser: help echo for buttons
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-doc.el31
1 files changed, 21 insertions, 10 deletions
diff --git a/elisp/geiser-doc.el b/elisp/geiser-doc.el
index eec0577..a25dd96 100644
--- a/elisp/geiser-doc.el
+++ b/elisp/geiser-doc.el
@@ -65,6 +65,12 @@ help (e.g. browse an HTML page) implementing this method.")
(defsubst geiser-doc--history-current ()
(car geiser-doc--history))
+(defsubst geiser-doc--history-previous-link ()
+ (ring-ref (cadr geiser-doc--history) 0))
+
+(defsubst geiser-doc--history-next-link ()
+ (ring-ref (caddr geiser-doc--history) 0))
+
(defun geiser-doc--history-push (link)
(unless (or (null link) (equal link (geiser-doc--history-current)))
(when (not (null (geiser-doc--history-current)))
@@ -183,6 +189,19 @@ help (e.g. browse an HTML page) implementing this method.")
(insert " "))
(geiser-doc--insert-xbutton))
+(defun geiser-doc--insert-nav-button (next)
+ (let* ((lnk (if next (geiser-doc--history-next-link)
+ (geiser-doc--history-previous-link)))
+ (what (geiser-doc--link-target lnk))
+ (what (or what (geiser-doc--link-module lnk)))
+ (action (if next '(lambda (b) (geiser-doc-next))
+ '(lambda (b) (geiser-doc-previous)))))
+ (insert-text-button (if next "[forward]" "[back]")
+ 'action action
+ 'help-echo (format "Previous help item (%s)" what)
+ 'face 'geiser-font-lock-doc-button
+ 'follow-link t)))
+
;;; Auxiliary functions:
@@ -234,18 +253,10 @@ help (e.g. browse an HTML page) implementing this method.")
(when (or prev nxt)
(insert (make-string len ?\ )))
(when prev
- (insert-text-button "[back]"
- 'action '(lambda (b) (geiser-doc-previous))
- 'help-echo "Previous help item"
- 'face 'geiser-font-lock-doc-button
- 'follow-link t)
+ (geiser-doc--insert-nav-button nil)
(insert " "))
(when nxt
- (insert-text-button "[forward]"
- 'action '(lambda (b) (geiser-doc-next))
- 'help-echo "Next help item"
- 'face 'geiser-font-lock-doc-button
- 'follow-link t))))
+ (geiser-doc--insert-nav-button t))))
;;; Commands: