emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Cannot display local images with orgmode under macOS
@ 2019-09-12  2:33 Zhengyu Duan
  2019-09-12 12:48 ` Marco Wahl
  0 siblings, 1 reply; 11+ messages in thread
From: Zhengyu Duan @ 2019-09-12  2:33 UTC (permalink / raw)
  To: emacs-orgmode

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

* The problem

    Orgmode under macOS cannot display local images correctly, but it can display internet images without problem.

    I tried both emacs-mac and emacs-plus, they both have this image problem. But emacs under ArchLinux don’t have this problem.

    [[file:xxx.png]]                              cannot be displayed even the file exists.
    [[./xxx.png]]                                  cannot be displayed even the file exists.
    [[http://example.org/xxx.png]]      can be displayed if the link exists.


    Emacs can display any images with C-x C-f xxx.png. The problem happens only with orgmode.

* The reason

    After bisecting org-mode source code I found out that this commit causes the problem:

    https://code.orgmode.org/bzg/org-mode/commit/48da60f47a77f4b99b4160fa620f258896ff4da3

    Reverting to previous commit fixes the problem.


    I’m new to Emacs and don’t understand the code of this commit. I cannot do further investigation.

* Screenshot

   File content:

    [[./cacochan.png]]

    [[https://github.com/hlissner/doom-emacs/raw/screenshots/cacochan.png]]

    Will show like this:

    

[-- Attachment #2.1: Type: text/html, Size: 2338 bytes --]

[-- Attachment #2.2: PastedGraphic-1.png --]
[-- Type: image/png, Size: 116533 bytes --]

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

* Re: Cannot display local images with orgmode under macOS
  2019-09-12  2:33 Cannot display local images with orgmode under macOS Zhengyu Duan
@ 2019-09-12 12:48 ` Marco Wahl
  2019-09-12 17:02   ` Berry, Charles
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Marco Wahl @ 2019-09-12 12:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

> * The problem
>
>     Orgmode under macOS cannot display local images correctly, but it can display internet images
> without problem.
>
>     I tried both emacs-mac and emacs-plus, they both have this image problem. But emacs under
> ArchLinux don’t have this problem.
>
>     [[file:xxx.png]]                              cannot be displayed even the file exists.
>     [[./xxx.png]]                                  cannot be displayed even the file exists.
>     [[http://example.org/xxx.png]]      can be displayed if the link exists.
>
>     Emacs can display any images with C-x C-f xxx.png. The problem happens only with orgmode.
>
> * The reason
>
>     After bisecting org-mode source code I found out that this commit causes the problem:
>
>     https://code.orgmode.org/bzg/org-mode/commit/48da60f47a77f4b99b4160fa620f258896ff4da3
>
>     Reverting to previous commit fixes the problem.

Gaa!  Looks like I did this.  With the commit one should be able to see
inline images also in the case when Emacs has been build without
imagemagick support, at least for newer Emacsens in the 27 line.

Unfortunately I don't have a Mac and cannot examine the behavior you
describe AFAICS.

Hopefully a Org community member with access to a Mac can have a look.


Thanks for reporting,
-- 
Marco

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

* Re: Cannot display local images with orgmode under macOS
  2019-09-12 12:48 ` Marco Wahl
@ 2019-09-12 17:02   ` Berry, Charles
  2019-09-13  4:37     ` Tim Cross
  2019-09-13 11:50   ` Rick Frankel
  2019-11-17 16:37   ` Jack Kamm
  2 siblings, 1 reply; 11+ messages in thread
From: Berry, Charles @ 2019-09-12 17:02 UTC (permalink / raw)
  To: Marco Wahl; +Cc: Org Mode



> On Sep 12, 2019, at 5:48 AM, Marco Wahl <marcowahlsoft@gmail.com> wrote:
> 
> Hi,
> 
>> * The problem
>> 
>>    Orgmode under macOS cannot display local images correctly, but it can display internet images
>> without problem.
>> 
>>    I tried both emacs-mac and emacs-plus, they both have this image problem. But emacs under
>> ArchLinux don’t have this problem.
>> 
>>    [[file:xxx.png]]                              cannot be displayed even the file exists.
>>    [[./xxx.png]]                                  cannot be displayed even the file exists.
>>    [[http://example.org/xxx.png]]      can be displayed if the link exists.
>> 
>>    Emacs can display any images with C-x C-f xxx.png. The problem happens only with orgmode.
>> 
>> * The reason
>> 
>>    After bisecting org-mode source code I found out that this commit causes the problem:
>> 
>>    https://code.orgmode.org/bzg/org-mode/commit/48da60f47a77f4b99b4160fa620f258896ff4da3
>> 
>>    Reverting to previous commit fixes the problem.
> 
> Gaa!  Looks like I did this.  With the commit one should be able to see
> inline images also in the case when Emacs has been build without
> imagemagick support, at least for newer Emacsens in the 27 line.
> 
> Unfortunately I don't have a Mac and cannot examine the behavior you
> describe AFAICS.
> 
> Hopefully a Org community member with access to a Mac can have a look.
> 
> 


I just updated org, I can see the offending commit.

After refreshing, I have no problems toggling display of inline images.

I have imagemagick and dvipng installed.

MacOS 10.14.6, Emacs 26.1, org release_9.2.6-534-g6f32e7

Is there anything else I can tell you?

HTH,

Chuck



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

* Re: Cannot display local images with orgmode under macOS
  2019-09-12 17:02   ` Berry, Charles
@ 2019-09-13  4:37     ` Tim Cross
  2019-09-14  7:43       ` Marco Wahl
  0 siblings, 1 reply; 11+ messages in thread
From: Tim Cross @ 2019-09-13  4:37 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Marco Wahl


Running Emacs 26.3 on macOS 10.14.6 with latest org and I have no
problems displaying images in org mode. I have imagemagick installed and
am using railwaycat's mac-port via homebrew.

Tim
Berry, Charles <ccberry@ucsd.edu> writes:

>> On Sep 12, 2019, at 5:48 AM, Marco Wahl <marcowahlsoft@gmail.com> wrote:
>> 
>> Hi,
>> 
>>> * The problem
>>> 
>>>    Orgmode under macOS cannot display local images correctly, but it can display internet images
>>> without problem.
>>> 
>>>    I tried both emacs-mac and emacs-plus, they both have this image problem. But emacs under
>>> ArchLinux don’t have this problem.
>>> 
>>>    [[file:xxx.png]]                              cannot be displayed even the file exists.
>>>    [[./xxx.png]]                                  cannot be displayed even the file exists.
>>>    [[http://example.org/xxx.png]]      can be displayed if the link exists.
>>> 
>>>    Emacs can display any images with C-x C-f xxx.png. The problem happens only with orgmode.
>>> 
>>> * The reason
>>> 
>>>    After bisecting org-mode source code I found out that this commit causes the problem:
>>> 
>>>    https://code.orgmode.org/bzg/org-mode/commit/48da60f47a77f4b99b4160fa620f258896ff4da3
>>> 
>>>    Reverting to previous commit fixes the problem.
>> 
>> Gaa!  Looks like I did this.  With the commit one should be able to see
>> inline images also in the case when Emacs has been build without
>> imagemagick support, at least for newer Emacsens in the 27 line.
>> 
>> Unfortunately I don't have a Mac and cannot examine the behavior you
>> describe AFAICS.
>> 
>> Hopefully a Org community member with access to a Mac can have a look.
>> 
>> 
>
>
> I just updated org, I can see the offending commit.
>
> After refreshing, I have no problems toggling display of inline images.
>
> I have imagemagick and dvipng installed.
>
> MacOS 10.14.6, Emacs 26.1, org release_9.2.6-534-g6f32e7
>
> Is there anything else I can tell you?
>
> HTH,
>
> Chuck


-- 
Tim Cross

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

* Re: Cannot display local images with orgmode under macOS
  2019-09-12 12:48 ` Marco Wahl
  2019-09-12 17:02   ` Berry, Charles
@ 2019-09-13 11:50   ` Rick Frankel
  2019-11-17 16:37   ` Jack Kamm
  2 siblings, 0 replies; 11+ messages in thread
From: Rick Frankel @ 2019-09-13 11:50 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Sep 12, 2019 at 02:48:15PM +0200, Marco Wahl wrote:
> Hi,
> >     Orgmode under macOS cannot display local images correctly, but it can display internet images
> > without problem.

> >     After bisecting org-mode source code I found out that this commit causes the problem:
> >
> >     https://code.orgmode.org/bzg/org-mode/commit/48da60f47a77f4b99b4160fa620f258896ff4da3
> >
> >     Reverting to previous commit fixes the problem.
>
> Gaa!  Looks like I did this.  With the commit one should be able to see
> inline images also in the case when Emacs has been build without
> imagemagick support, at least for newer Emacsens in the 27 line.
>
> Unfortunately I don't have a Mac and cannot examine the behavior you
> describe AFAICS.
>

On a mac, latest org and emacs masters, inline images work find

Org version:

  commit 6f32e7af88805441c1261e16f729172639d8b3fa (HEAD -> master, origin/master, origin/HEAD)


Abbreviated emacs config output (no imagemagick):

  What compiler should emacs be built with?               clang -O
  What window system should Emacs use?                    nextstep
  What toolkit should Emacs use?                          none
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   no
  Does Emacs use -ljpeg?                                  no
  Does Emacs use -ltiff?                                  no
  Does Emacs use a gif library?                           no
  Does Emacs use a png library?                           no
  Does Emacs use -lrsvg-2?                                yes
  Does Emacs use cairo?                                   no
  Does Emacs use -llcms2?                                 yes
  Does Emacs use imagemagick?                             no
  Does Emacs use -lgmp?                                   yes
  Does Emacs directly use zlib?                           yes
  Does Emacs have dynamic modules support?                no
  Does Emacs use toolkit scroll bars?                     yes
  Does Emacs support Xwidgets (requires gtk3)?            no

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

* Re: Cannot display local images with orgmode under macOS
  2019-09-13  4:37     ` Tim Cross
@ 2019-09-14  7:43       ` Marco Wahl
  2019-09-27 10:30         ` Zhengyu Duan
  0 siblings, 1 reply; 11+ messages in thread
From: Marco Wahl @ 2019-09-14  7:43 UTC (permalink / raw)
  To: Tim Cross, Zhengyu Duan, Berry, Charles, Rick Frankel; +Cc: emacs-orgmode

Hi!

Thanks all for checking the issue!

>>>> * The problem
>>>> 
>>>>    Orgmode under macOS cannot display local images correctly, but
>>>> it can display internet images
>>>> without problem.
>>>> 
>>>>    I tried both emacs-mac and emacs-plus, they both have this
>>>> image problem. But emacs under
>>>> ArchLinux don’t have this problem.
>>>> 
>>>>    [[file:xxx.png]] cannot be displayed even the file exists.
>>>>    [[./xxx.png]] cannot be displayed even the file exists.
>>>>    [[http://example.org/xxx.png]]      can be displayed if the link exists.

Your analysis hints to check the handling of images given by an url
vs. given by file.  I think this is something for somewhen else.  (At
least I captured a respective task.)

Regarding the issue about the display of inline images the tests
can be summarized like this:

|       | OS          |  Emacs | magick | inline images |
|       |             |        |        | display       |
|-------+-------------+--------+--------+---------------|
| Duan  | arch        |        |        | yes           |
| Duan  | mac         |        |        | no            |
| Chuck | mac 10.14.6 |   26.1 | yes    | yes           |
| Tim   | mac 10.14.6 |   26.3 | yes    | yes           |
| Rick  | mac         | master | no     | yes           |

This is indication that there is an individual issue on Duan's side
AFAICT.

I highly recommend to blend out the individual configuration and try
again.  If the display still fails then provide a concrete minimal
complete example for further invesigation.


Thanks all and best regards,
-- 
Marco

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

* Re: Cannot display local images with orgmode under macOS
  2019-09-14  7:43       ` Marco Wahl
@ 2019-09-27 10:30         ` Zhengyu Duan
  2019-09-27 16:27           ` Marco Wahl
  0 siblings, 1 reply; 11+ messages in thread
From: Zhengyu Duan @ 2019-09-27 10:30 UTC (permalink / raw)
  To: Marco Wahl; +Cc: emacs-orgmode

My image display problem was fixed with this commit

https://github.com/hlissner/doom-emacs/commit/87b7a8da052601c51bc0577484916856364401cb



> On Sep 14, 2019, at 15:43, Marco Wahl <marcowahlsoft@gmail.com> wrote:
> 
> Hi!
> 
> Thanks all for checking the issue!
> 
>>>>> * The problem
>>>>> 
>>>>>   Orgmode under macOS cannot display local images correctly, but
>>>>> it can display internet images
>>>>> without problem.
>>>>> 
>>>>>   I tried both emacs-mac and emacs-plus, they both have this
>>>>> image problem. But emacs under
>>>>> ArchLinux don’t have this problem.
>>>>> 
>>>>>   [[file:xxx.png]] cannot be displayed even the file exists.
>>>>>   [[./xxx.png]] cannot be displayed even the file exists.
>>>>>   [[http://example.org/xxx.png]]      can be displayed if the link exists.
> 
> Your analysis hints to check the handling of images given by an url
> vs. given by file.  I think this is something for somewhen else.  (At
> least I captured a respective task.)
> 
> Regarding the issue about the display of inline images the tests
> can be summarized like this:
> 
> |       | OS          |  Emacs | magick | inline images |
> |       |             |        |        | display       |
> |-------+-------------+--------+--------+---------------|
> | Duan  | arch        |        |        | yes           |
> | Duan  | mac         |        |        | no            |
> | Chuck | mac 10.14.6 |   26.1 | yes    | yes           |
> | Tim   | mac 10.14.6 |   26.3 | yes    | yes           |
> | Rick  | mac         | master | no     | yes           |
> 
> This is indication that there is an individual issue on Duan's side
> AFAICT.
> 
> I highly recommend to blend out the individual configuration and try
> again.  If the display still fails then provide a concrete minimal
> complete example for further invesigation.
> 
> 
> Thanks all and best regards,
> -- 
> Marco

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

* Re: Cannot display local images with orgmode under macOS
  2019-09-27 10:30         ` Zhengyu Duan
@ 2019-09-27 16:27           ` Marco Wahl
  0 siblings, 0 replies; 11+ messages in thread
From: Marco Wahl @ 2019-09-27 16:27 UTC (permalink / raw)
  To: emacs-orgmode

Zhengyu Duan <steamedfish@njuopen.com> writes:

> My image display problem was fixed with this commit
>
> https://github.com/hlissner/doom-emacs/commit/87b7a8da052601c51bc0577484916856364401cb

Thanks for the information!


Ciao,
-- 
Marco

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

* Re: Cannot display local images with orgmode under macOS
  2019-09-12 12:48 ` Marco Wahl
  2019-09-12 17:02   ` Berry, Charles
  2019-09-13 11:50   ` Rick Frankel
@ 2019-11-17 16:37   ` Jack Kamm
  2019-11-17 22:55     ` Jack Kamm
  2 siblings, 1 reply; 11+ messages in thread
From: Jack Kamm @ 2019-11-17 16:37 UTC (permalink / raw)
  To: Marco Wahl, emacs-orgmode

Hello,

I want to report that this bug is not specific to macOS, and also
affects Linux.

Specifically, I am running Archlinux-packaged emacs 26.3, and am
encountering this same issue. Ever since commit
48da60f47a77f4b99b4160fa620f258896ff4da3, org-mode no longer displays
inline images for me.

I tested this with "emacs -q" and an org-file with a link to a PNG image.

Jack

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

* Re: Cannot display local images with orgmode under macOS
  2019-11-17 16:37   ` Jack Kamm
@ 2019-11-17 22:55     ` Jack Kamm
  2019-11-18 21:58       ` Marco Wahl
  0 siblings, 1 reply; 11+ messages in thread
From: Jack Kamm @ 2019-11-17 22:55 UTC (permalink / raw)
  To: Marco Wahl, emacs-orgmode

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

I've attached a patch which I believe fixes the issue.

The problem appears to be that, when imagemagick is installed and the
image width is unset, that the image will be created by an elisp
expression like

(create-file "some/image.png" 'imagemagick nil :width nil)

which doesn't work, maybe because imagemagick tries to create a 0-width
image.

The attached patch reverts to the old behavior of only using imagemagick
when width is non-nil, fixing the bug introduced by 48da60f47.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Fix-images-failing-to-display-with-imagemagick.patch --]
[-- Type: text/x-patch, Size: 949 bytes --]

From cebf2b4001015dabc74364ac2a5bf2ed64c07ab0 Mon Sep 17 00:00:00 2001
From: Jack Kamm <jackkamm@gmail.com>
Date: Sun, 17 Nov 2019 14:30:35 -0800
Subject: [PATCH] org: Fix images failing to display with imagemagick

See also: https://lists.gnu.org/archive/html/emacs-orgmode/2019-09/msg00111.html
Despite the subject of that message thread, the issue also affects
some Linux users.
---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index f29298266..b65b7d221 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16755,7 +16755,8 @@ boundaries."
 		    (if (and (car-safe old) refresh)
 			(image-refresh (overlay-get (cdr old) 'display))
 		      (let ((image (create-image file
-						 (and (image-type-available-p 'imagemagick) 'imagemagick)
+						 (and (image-type-available-p 'imagemagick)
+						      width 'imagemagick)
 						 nil
 						 :width width)))
 			(when image
-- 
2.24.0


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

* Re: Cannot display local images with orgmode under macOS
  2019-11-17 22:55     ` Jack Kamm
@ 2019-11-18 21:58       ` Marco Wahl
  0 siblings, 0 replies; 11+ messages in thread
From: Marco Wahl @ 2019-11-18 21:58 UTC (permalink / raw)
  To: Jack Kamm; +Cc: emacs-orgmode

Jack Kamm <jackkamm@gmail.com> writes:

> I've attached a patch which I believe fixes the issue.

Thanks.

> The problem appears to be that, when imagemagick is installed and the
> image width is unset, that the image will be created by an elisp
> expression like
>
> (create-file "some/image.png" 'imagemagick nil :width nil)
>
> which doesn't work, maybe because imagemagick tries to create a 0-width
> image.
>
> The attached patch reverts to the old behavior of only using imagemagick
> when width is non-nil, fixing the bug introduced by 48da60f47.

Your patch is on the branches master and next now.  I added the word
TINYCHANGE to your commit message.


Ciao

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

end of thread, other threads:[~2019-11-18 21:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12  2:33 Cannot display local images with orgmode under macOS Zhengyu Duan
2019-09-12 12:48 ` Marco Wahl
2019-09-12 17:02   ` Berry, Charles
2019-09-13  4:37     ` Tim Cross
2019-09-14  7:43       ` Marco Wahl
2019-09-27 10:30         ` Zhengyu Duan
2019-09-27 16:27           ` Marco Wahl
2019-09-13 11:50   ` Rick Frankel
2019-11-17 16:37   ` Jack Kamm
2019-11-17 22:55     ` Jack Kamm
2019-11-18 21:58       ` Marco Wahl

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).