all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dustin Lacewell <dlacewell@gmail.com>
To: 40047@debbugs.gnu.org
Subject: bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX
Date: Thu, 12 Mar 2020 16:54:26 -0500	[thread overview]
Message-ID: <CAMDmBpE=CRRm=N9XxsyUTL2VDQJ1tZfY1Us1MGU_9qspOkrBog@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2020-03-12 21:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-12 21:54 Dustin Lacewell [this message]
2020-03-13  8:18 ` bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMDmBpE=CRRm=N9XxsyUTL2VDQJ1tZfY1Us1MGU_9qspOkrBog@mail.gmail.com' \
    --to=dlacewell@gmail.com \
    --cc=40047@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.