all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
@ 2020-03-12 21:54 Dustin Lacewell
  2020-03-13  8:18 ` Eli Zaretskii
  2020-03-13 15:17 ` Alan Third
  0 siblings, 2 replies; 11+ messages in thread
From: Dustin Lacewell @ 2020-03-12 21:54 UTC (permalink / raw)
  To: 40047

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

--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.

[-- Attachment #2: Type: text/html, Size: 2133 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-03-14 10:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-12 21:54 bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX Dustin Lacewell
2020-03-13  8:18 ` Eli Zaretskii
2020-03-13 12:11   ` Stephen Berman
2020-03-13 14:24     ` Eli Zaretskii
2020-03-13 15:00       ` Dustin Lacewell
2020-03-14  8:49       ` martin rudalics
2020-03-14 10:11         ` Eli Zaretskii
2020-03-13 15:17 ` Alan Third
2020-03-13 15:57   ` Eli Zaretskii
2020-03-13 23:17     ` Alan Third
2020-03-14  8:12       ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.