branch: elpa/xkcd
commit 7b1a312239c0c9175948aa853185bf2c62dac39a
Author: Raphaël Cauderlier <[email protected]>
Commit: Raphaël Cauderlier <[email protected]>
Add an help-echo text property to display the alt-text
---
xkcd.el | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/xkcd.el b/xkcd.el
index 940ac9185d..8002c8fa8b 100644
--- a/xkcd.el
+++ b/xkcd.el
@@ -139,11 +139,14 @@ be located in xkcd-cache-dir"
(setq title (format "%d: %s" (cdr (assoc 'num (json-read-from-string out)))
(cdr (assoc 'safe_title (json-read-from-string out)))))
(insert (concat title "\n"))
- (insert-image (create-image
- (concat xkcd-cache-dir
- (number-to-string
- (cdr
- (assoc 'num (json-read-from-string out)))) ".png")
'png))
+ (let ((start (point)))
+ (insert-image (create-image
+ (concat xkcd-cache-dir
+ (number-to-string
+ (cdr
+ (assoc 'num (json-read-from-string out))))
".png") 'png))
+ (add-text-properties start (point) '(help-echo xkcd-alt))
+ )
(if (eq xkcd-cur 0)
(setq xkcd-cur (cdr (assoc 'num (json-read-from-string out)))))
(xkcd-cache-json num out)