GNU bug report logs -
#40047
Images in tooltip-mode tooltips broken on Linux (with x-gtk-use-system-tooltips=t) and OSX
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
--text follows this line--
It appears that images in tooltip-mode tooltips is currently broken on
most platforms besides windows. The following snippet should provide an
example:
(defun my-download-as-string (url)
"Download file from URL and return it as string."
(let ((image-buf (url-retrieve-synchronously url)))
(when image-buf
(with-current-buffer image-buf
(goto-char (point-min))
(when (looking-at "HTTP/")
(delete-region (point-min)
(progn (re-search-forward "\n[\n]+")
(point))))
(buffer-substring-no-properties (point-min) (point-max))))))
(defun my-download-image (url)
"Download URL as image."
(create-image (my-download-as-string url) (image-type-from-file-name url)
t))
(with-current-buffer (get-buffer-create "*TooltipTest*")
(tooltip-mode)
(insert
(propertize "Facepalm" 'help-echo
(propertize " " 'display
(my-download-image "
https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Paris_Tuileries_Garden_Facepalm_statue.jpg/300px-Paris_Tuileries_Garden_Facepalm_statue.jpg
"))))
(display-buffer (current-buffer)))
Just `eval-buffer` then hover your mouse over `Facepalm` in the new
buffer.
Emacs versions 26.2 26.3 and 28.0.50 were tested on NixOS, Ubuntu, OSX
and Windows.
On Windows a tooltip displays an image. On Linux (NixOS, Ubuntu) and OSX
only a small empty tooltip is presented.
One package I was able to identify that uses this behavior is Dired+
This feature is also useful in general to maintain the readability of
org-mode documents for example.
[Message part 2 (text/html, inline)]
This bug report was last modified 5 years and 95 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.