From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dustin Lacewell Newsgroups: gmane.emacs.bugs Subject: bug#40047: 26.2; Images in tooltip-mode tooltips broken on Linux and OSX Date: Thu, 12 Mar 2020 16:54:26 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000267a7b05a0af6630" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="96189"; mail-complaints-to="usenet@ciao.gmane.io" To: 40047@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 12 23:12:15 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jCW3q-000Ops-Fk for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Mar 2020 23:12:14 +0100 Original-Received: from localhost ([::1]:51058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCW3p-0003OU-5g for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Mar 2020 18:12:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51039) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCW3f-0003BK-Rh for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 18:12:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCW3e-0008Hp-Fb for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 18:12:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51943) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCW3e-0008HU-A9 for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 18:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jCW3e-0004Kf-4d for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 18:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dustin Lacewell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Mar 2020 22:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 40047 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.158405112016642 (code B ref -1); Thu, 12 Mar 2020 22:12:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Mar 2020 22:12:00 +0000 Original-Received: from localhost ([127.0.0.1]:57916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCW3c-0004KJ-2D for submit@debbugs.gnu.org; Thu, 12 Mar 2020 18:12:00 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:47315) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCVmr-0003qE-5b for submit@debbugs.gnu.org; Thu, 12 Mar 2020 17:54:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40153) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCVmp-00037C-K8 for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 17:54:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCVmo-00072y-AS for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 17:54:39 -0400 Original-Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]:34650) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCVmo-00071F-3S for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 17:54:38 -0400 Original-Received: by mail-qv1-xf29.google.com with SMTP id o18so3500433qvf.1 for ; Thu, 12 Mar 2020 14:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=kDuWShKKaEPceaFLWzKuFRxYDGKZNpJmhTMTc6wXt5E=; b=ub+E6BmOCyJXO5tHPUSbRGPi/sK9724uLbftOKijP8sMvaXeZcWja5p5SCVwlFw9eC vwWvv6he6khBi9vqVo+QBpcTNHxFXWbdLYhzvO8WQREywK64RfuH4ITtJbmCD6YqMLHs hP7/7ZbpPd4bJlIbf6wbhbKSBVbh4z/6DI19Jgjo+/y8+wvO28g+HWtxC1vum82sIJXe 6PIyywbJhqj37AkHFOccL06LiR9yt0mx4i3OAB9tbf1gVAmUId510HA6b7cxxtOtSLWt zl/ak084sU2tH/epSMYqPpQMdyVhOMpcw5Hvg2T4P25I3HIoTj7DWJHxP7laVW5yxRQh 7RFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=kDuWShKKaEPceaFLWzKuFRxYDGKZNpJmhTMTc6wXt5E=; b=VaxWwPc2troXyJtuJohsFaptO85cpKFUtv0tNxg4k6sJVLwvRyXhVEhHCkzM+rxW1d ac0tv8vUwSQnqCQzwhXHwFhJOkEY8fYEDfI/eVjirVXYLIdrG5gC8FCymf7VL2cOCXp2 YIeP5a+vDireauX6IBu3lNJUHeAY5adFmvZoila+CCJi4tvQnU3OTJSqkFwvujXfwI0j xkCwksErePlMO6Q2ULOXdq1vcKKvLvjw77dnDKiP1TCQkwTgbsjxYb9x7df8vfW93bMr 8i6wiSZ7TqXI4WgTiaDKRLc1x+zaVjA0z3qtRDI4pcI912aZXN30EGjVuqf9KFHWeKO4 h4bw== X-Gm-Message-State: ANhLgQ1oPnuWip3qcNzHICWblNT0roG4Xp4Omdj5L9nCkyk7yI58xbYj hE+qpZwZj7iLNeHsL9NTm7Brex6uznqqtejqhXPoQpFWw10= X-Google-Smtp-Source: ADFU+vsvu8vPcu3XAj7tbc+z6VXZMo+u5zreUv3JEZJD5fc4iMuZ8DgoEsaql2CYcCFHUZK93GjSTq7SI70Y6eASfc0= X-Received: by 2002:a0c:f985:: with SMTP id t5mr9582135qvn.127.1584050077070; Thu, 12 Mar 2020 14:54:37 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Mailman-Approved-At: Thu, 12 Mar 2020 18:11:58 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177235 Archived-At: --000000000000267a7b05a0af6630 Content-Type: text/plain; charset="UTF-8" --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. --000000000000267a7b05a0af6630 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
--text follows this line--

It appears that images i= n tooltip-mode tooltips is currently broken on
most platforms besides wi= ndows. The following snippet should provide an
example:

(defun my= -download-as-string (url)
=C2=A0 "Download file from URL and return= it as string."
=C2=A0 (let ((image-buf (url-retrieve-synchronously= url)))
=C2=A0 =C2=A0 (when image-buf
=C2=A0 =C2=A0 =C2=A0 (with-curr= ent-buffer image-buf
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char (point-min))=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (looking-at "HTTP/")
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (delete-region (point-min)
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(progn (re-search-forward "\n[\n]+")
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (point))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (buffer-substri= ng-no-properties (point-min) (point-max))))))

(defun my-download-ima= ge (url)
=C2=A0 "Download URL as image."
=C2=A0 (create-ima= ge (my-download-as-string url) (image-type-from-file-name url) t))

(= with-current-buffer (get-buffer-create "*TooltipTest*")
=C2=A0= (tooltip-mode)
=C2=A0 (insert
=C2=A0 =C2=A0(propertize "Facepal= m" 'help-echo
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(propertize " " 'display
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(my-d= ownload-image "https://upload.wikimedia.org/wikipedia/comm= ons/thumb/3/3b/Paris_Tuileries_Garden_Facepalm_statue.jpg/300px-Paris_Tuile= ries_Garden_Facepalm_statue.jpg"))))
=C2=A0 (display-buffer (cu= rrent-buffer)))

Just `eval-buffer` then hover your mouse over `Facep= alm` 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 d= isplays an image. On Linux (NixOS, Ubuntu) and OSX
only a small empty to= oltip is presented.

One package I was able to identify that uses thi= s behavior is Dired+

This feature is also useful in general to maint= ain the readability of
org-mode documents for example.
--000000000000267a7b05a0af6630--