From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Displaying inline svg images Date: Wed, 9 Jan 2019 00:25:23 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000007d7842057effb2da" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:50455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gh6NR-0004LD-2w for emacs-orgmode@gnu.org; Wed, 09 Jan 2019 00:26:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gh6NP-0001ZA-U0 for emacs-orgmode@gnu.org; Wed, 09 Jan 2019 00:26:05 -0500 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:44397) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gh6NP-0001YW-Fy for emacs-orgmode@gnu.org; Wed, 09 Jan 2019 00:26:03 -0500 Received: by mail-lj1-x229.google.com with SMTP id k19-v6so5363016lji.11 for ; Tue, 08 Jan 2019 21:26:03 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-org list --0000000000007d7842057effb2da Content-Type: text/plain; charset="UTF-8" Hello, I am unable to display inline SVG images. Here is the minimum reproducible example: 1. I have org-image-actual-width defcustom at its default value of t. 2. Here is the Org file: ===== #+startup: inlineimages [[file:red-blue-squares.svg]] ===== 3. Here is the example SVG file. Put it in the same dir as the Org file as red-blue-squares.svg. ===== ===== Upon saving the .svg file and then opening the .org file, I do not see the image inlined. Is anyone able to reproduce this? Upon investigating the org-display-inline-images function in org.el, I found that this happens because the internal variable width is evaluated as nil and `:width nil' gets passed to the `create-image' function .. resulting in a zero-width SVG. Though, this is not a problem with PNG and JPG images. As a quick workaround, I did this: ===== diff --git a/lisp/org.el b/lisp/org.el index ea1607d85..54e8d0142 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18618,7 +18618,8 @@ boundaries." (let ((image (create-image file (and width 'imagemagick) nil - :width width))) + ;; :width width + ))) (when image (let ((ov (make-overlay (org-element-property :begin link) ===== i.e. I stopped passing the :width property to create-image altogether and after that the SVG image showed inline just fine. So, is there any point passing `:width width' if width is nil? If not, I can work on a patch that prevents passing that property only in that case. Org version: Org mode version 9.2 (release_9.2-151-g8a5d8f ..) | master branch Emacs version: GNU Emacs 27.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 2.24.23) of 2019-01-08, built using commit 55c5e26307a1e8f1fff74415fc560aa172a421cf | master branch -- Kaushal Modi --0000000000007d7842057effb2da Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I am unable to display inline SVG images.

He= re is the minimum reproducible example:

1. I have = org-image-actual-width defcustom at its default value of t.
2. He= re is the Org file:

=3D=3D=3D=3D=3D
#+st= artup: inlineimages

[[file:red-blue-squares.svg]]
=3D= =3D=3D=3D=3D

3. Here is the example SVG file. Put = it in the same dir as the Org file as red-blue-squares.svg.


As a quick workaround, I did this:

=3D=3D= =3D=3D=3D
diff --git a/lisp/org.el b/lisp/org.el
index ea1607d= 85..54e8d0142 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18618= ,7 +18618,8 @@ boundaries."
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 (let ((image (create-image file
=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 =C2=A0=C2=A0=C2=A0 (and width 'imagemagick)
=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 =C2=A0=C2=A0=C2=A0 nil
-=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=C2=A0=C2=A0 :width width)))
+=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=C2=A0=C2=A0= ;; :width width
+=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=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 = (when image
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0(let ((ov (make-overlay
=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 (org-elemen= t-property :begin link)
=3D=3D=3D=3D=3D

i.e. I = stopped passing the :width property to create-image altogether and after th= at the SVG image showed inline just fine.

So, is t= here any point passing `:width width' if width is nil? If not, I can wo= rk on a patch that prevents passing that property only in that case.



Org version= : Org mode version 9.2 (release_9.2-151-g8a5d8f ..) | master branch
Emacs version: GNU Emacs 27.0.50 (build 5, x86_64-pc-linux-gnu, GTK= + Version 2.24.23)
=C2=A0of 2019-01-08, built using commit 55c5e26307a1e= 8f1fff74415fc560aa172a421cf | master branch

--
Kaushal Modi
--0000000000007d7842057effb2da--