emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
       [not found] <388850760.3644614.1634354740816.ref@mail.yahoo.com>
@ 2021-10-16  3:25 ` Sun Lin
  2021-10-18  1:39   ` Sun Lin
  2021-11-18  7:38   ` Timothy
  0 siblings, 2 replies; 10+ messages in thread
From: Sun Lin @ 2021-10-16  3:25 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

When the environment variable "DISPLAY" is invalid, exporting plantuml block in org will got error message:
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using 'localhost:11.0' as the value of the DISPLAY variable.
    at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
...
To reproduce this issue, install the plantuml.jar and make sure it work inside org-mode.
Then open `/tmp/testing.org` and  input follow plantuml code and eval-expression `(progn (setenv "DISPLAY" "localhost:90")(org-html-export-to-html))`.
The root cause is org-mord execute the plantuml.jar in command line without headless parameter, then plantuml will try read the DISPLAY, it's unnecessary.
(For standalone plantuml, `org-plantuml-executable-args` has default value '-headless' to avoid reading DISPLAY).

Please help review the patch. Thanks.

Best Regards
Lin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-DISPLAY-error-on-exporting-org-with-plantuml-to-.patch --]
[-- Type: text/x-patch, Size: 927 bytes --]

From 5e04a800691b04edd940dd124987336f6f30dd62 Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Sat, 16 Oct 2021 03:01:18 +0000
Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html

* org-babel-execute:plantuml: using headless mode for org calling plantuml for exporting to html
---
 lisp/ob-plantuml.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el
index fc62160..7d92227 100644
--- a/lisp/ob-plantuml.el
+++ b/lisp/ob-plantuml.el
@@ -122,6 +122,7 @@ This function is called by `org-babel-execute-src-block'."
 				((not (file-exists-p org-plantuml-jar-path))
 				 (error "Could not find plantuml.jar at %s" org-plantuml-jar-path))
 				(t (list java
+					 "-Djava.awt.headless=true"
 					 "-jar"
 					 (shell-quote-argument (expand-file-name org-plantuml-jar-path))))))
 	 (full-body (org-babel-plantuml-make-body body params))
-- 
2.7.0


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

* Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
  2021-10-16  3:25 ` Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html Sun Lin
@ 2021-10-18  1:39   ` Sun Lin
  2021-10-18  5:07     ` Bastien Guerry
  2021-11-18  7:38   ` Timothy
  1 sibling, 1 reply; 10+ messages in thread
From: Sun Lin @ 2021-10-18  1:39 UTC (permalink / raw)
  To: emacs-orgmode, bzg

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


Hi Bastien,

Please help to review this patch. Thanks

Best Regards

Lin Sun

----- Forwarded Message -----

From: Sun Lin <sunlin7@yahoo.com>
To: emacs-orgmode@gnu.org <emacs-orgmode@gnu.org>
Sent: Saturday, October 16, 2021, 03:25:40 AM UTC
Subject: Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html


Hi,

When the environment variable "DISPLAY" is invalid, exporting plantuml block in org will got error message:
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using 'localhost:11.0' as the value of the DISPLAY variable.
    at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
...
To reproduce this issue, install the plantuml.jar and make sure it work inside org-mode.
Then open `/tmp/testing.org` and  input follow plantuml code and eval-expression `(progn (setenv "DISPLAY" "localhost:90")(org-html-export-to-html))`.
The root cause is org-mord execute the plantuml.jar in command line without headless parameter, then plantuml will try read the DISPLAY, it's unnecessary.
(For standalone plantuml, `org-plantuml-executable-args` has default value '-headless' to avoid reading DISPLAY).

Please help review the patch. Thanks.

Best Regards
Lin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-DISPLAY-error-on-exporting-org-with-plantuml-to-.patch --]
[-- Type: text/x-patch, Size: 927 bytes --]

From 5e04a800691b04edd940dd124987336f6f30dd62 Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Sat, 16 Oct 2021 03:01:18 +0000
Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html

* org-babel-execute:plantuml: using headless mode for org calling plantuml for exporting to html
---
 lisp/ob-plantuml.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el
index fc62160..7d92227 100644
--- a/lisp/ob-plantuml.el
+++ b/lisp/ob-plantuml.el
@@ -122,6 +122,7 @@ This function is called by `org-babel-execute-src-block'."
 				((not (file-exists-p org-plantuml-jar-path))
 				 (error "Could not find plantuml.jar at %s" org-plantuml-jar-path))
 				(t (list java
+					 "-Djava.awt.headless=true"
 					 "-jar"
 					 (shell-quote-argument (expand-file-name org-plantuml-jar-path))))))
 	 (full-body (org-babel-plantuml-make-body body params))
-- 
2.7.0


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

* Re: Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
  2021-10-18  1:39   ` Sun Lin
@ 2021-10-18  5:07     ` Bastien Guerry
  2021-10-20 12:02       ` Sun Lin
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien Guerry @ 2021-10-18  5:07 UTC (permalink / raw)
  To: Sun Lin; +Cc: emacs-orgmode

Hi,

Sun Lin <sunlin7@yahoo.com> writes:

> Please help to review this patch.

I will - but please be aware that we have a policy of waiting at least
one month before bumping a thread:

https://orgmode.org/worg/org-mailing-list.html#i-didnt-receive-an-answer

Thanks,

-- 
 Bastien


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

* Re: Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
  2021-10-18  5:07     ` Bastien Guerry
@ 2021-10-20 12:02       ` Sun Lin
  2021-11-18  5:42         ` Sun Lin
  0 siblings, 1 reply; 10+ messages in thread
From: Sun Lin @ 2021-10-20 12:02 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: emacs-orgmode

Hi Bastien,

Okay, waiting a month is no problem for me, I'll give org version info in future patches.

The patch is for org version:
Org mode version 9.5 (release_9.5-46-gb71474 @ ~/.root/share/emacs/28.0.60/lisp/org/)

And the reproduce steps are edit /tmp/testing.org and eval-expression 
(progn (setenv "DISPLAY" "localhost:90")(org-html-export-to-html))

# testing.org
#+BEGIN_SRC plantuml :cmdline -charset UTF-8 :file testing.png
  @startuml
  a -> b: testing
  @enduml
#+END_SRC


Thanks.

--
Lin


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

* Re: Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
  2021-10-20 12:02       ` Sun Lin
@ 2021-11-18  5:42         ` Sun Lin
  0 siblings, 0 replies; 10+ messages in thread
From: Sun Lin @ 2021-11-18  5:42 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: emacs-orgmode

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

Hi Bastien,

> Hi,
> I will - but please be aware that we have a policy of waiting at least
> one month before bumping a thread:
> https://orgmode.org/worg/org-mailing-list.html#i-didnt-receive-an-answer
> Thanks,
> Bastien

Please help the patch, thanks.

Lin    

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-DISPLAY-error-on-exporting-org-with-plantuml-to-.patch --]
[-- Type: text/x-patch, Size: 927 bytes --]

From 5e04a800691b04edd940dd124987336f6f30dd62 Mon Sep 17 00:00:00 2001
From: Lin Sun <lin.sun@zoom.us>
Date: Sat, 16 Oct 2021 03:01:18 +0000
Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html

* org-babel-execute:plantuml: using headless mode for org calling plantuml for exporting to html
---
 lisp/ob-plantuml.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el
index fc62160..7d92227 100644
--- a/lisp/ob-plantuml.el
+++ b/lisp/ob-plantuml.el
@@ -122,6 +122,7 @@ This function is called by `org-babel-execute-src-block'."
 				((not (file-exists-p org-plantuml-jar-path))
 				 (error "Could not find plantuml.jar at %s" org-plantuml-jar-path))
 				(t (list java
+					 "-Djava.awt.headless=true"
 					 "-jar"
 					 (shell-quote-argument (expand-file-name org-plantuml-jar-path))))))
 	 (full-body (org-babel-plantuml-make-body body params))
-- 
2.7.0


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

* Re: Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
  2021-10-16  3:25 ` Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html Sun Lin
  2021-10-18  1:39   ` Sun Lin
@ 2021-11-18  7:38   ` Timothy
  2021-11-18  7:47     ` Sun Lin
  1 sibling, 1 reply; 10+ messages in thread
From: Timothy @ 2021-11-18  7:38 UTC (permalink / raw)
  To: Sun Lin; +Cc: emacs-orgmode


Hi Sun,

> [snipped patch description]
> Please help review the patch. Thanks.
> [2. text/x-patch; 0001-Fix-DISPLAY-error-on-exporting-org-with-plantuml-to-.patch]...

Thanks for your patience. This looks quite straight-forward. I don't use
or have plantuml so I'm in a poor position to test.

However, I can use google, and it seems that -Djava.awt.headless=true
just uses Java for some graphics operations which are normally delegated
to the system graphics stack.

This seems rather safe to me, and so I'd be inclined to take your word
that this is a beneficial change and merge the patch.

All the best,
Timothy


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

* Re: Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
  2021-11-18  7:38   ` Timothy
@ 2021-11-18  7:47     ` Sun Lin
  2021-11-30  1:41       ` Sun Lin
  0 siblings, 1 reply; 10+ messages in thread
From: Sun Lin @ 2021-11-18  7:47 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode

Hi Timothy,

Thank you so much!

B.R.
Lin


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

* Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
  2021-11-18  7:47     ` Sun Lin
@ 2021-11-30  1:41       ` Sun Lin
  2021-11-30  4:18         ` Timothy
  0 siblings, 1 reply; 10+ messages in thread
From: Sun Lin @ 2021-11-30  1:41 UTC (permalink / raw)
  To: Timothy, tec, marcowahlsoft, Bastien Guerry; +Cc: emacs-orgmode

Hi Timothy,

Can any help merge the patch? Or should I request Bastien to merge the patch? 
Thanks.

B.R.
Lin

>On Thursday, November 18, 2021, 07:42:24 AM UTC, Timothy <tecosaur@gmail.com> wrote:

>Hi Sun,

>> [snipped patch description]

>> Please help review the patch. Thanks.

>> [2. text/x-patch; 0001-Fix-DISPLAY-error-on-exporting-org-with-plantuml-to-.patch]...

>Thanks for your patience. This looks quite straight-forward. I don't use
>or have plantuml so I'm in a poor position to test.

>However, I can use google, and it seems that -Djava.awt.headless=true
>just uses Java for some graphics operations which are normally delegated
>to the system graphics stack.

>This seems rather safe to me, and so I'd be inclined to take your word
>that this is a beneficial change and merge the patch.

>All the best,

>Timothy


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

* Re: Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
  2021-11-30  1:41       ` Sun Lin
@ 2021-11-30  4:18         ` Timothy
  2021-11-30  6:05           ` Sun Lin
  0 siblings, 1 reply; 10+ messages in thread
From: Timothy @ 2021-11-30  4:18 UTC (permalink / raw)
  To: Sun Lin; +Cc: Bastien Guerry, marcowahlsoft, emacs-orgmode

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

Hi Sun,

> Can any help merge the patch? Or should I request Bastien to merge the patch? 

Thanks for not forgetting about this. As I commented before, I this looks
sensible enough to apply, and so I’ve just pushed it as f9dcc3d with a tweaked
commit message.

You’ve also been added to the list of TINYCHANGE contributors on
<https://orgmode.org/worg/contributors.html>. If you submit more than 20
cumulative lines of non-trivial code, you’ll need to get FSF assignment.

Thanks for sharing the issue and making a patch for it 🙂 hopefully we’ll see
you around in the future.

All the best,
Timothy

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

* Re: Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html
  2021-11-30  4:18         ` Timothy
@ 2021-11-30  6:05           ` Sun Lin
  0 siblings, 0 replies; 10+ messages in thread
From: Sun Lin @ 2021-11-30  6:05 UTC (permalink / raw)
  To: Timothy; +Cc: marcowahlsoft, Bastien Guerry, emacs-orgmode

Hi Timothy,

Thank you! : ) 

I had signed the FSF, RT: 1718442. 

B.R.
 Lin

On Tuesday, November 30, 2021, 04:22:03 AM UTC, Timothy <tecosaur@gmail.com> wrote: 
> Hi Sun,

> Thanks for not forgetting about this. As I commented before, I this looks
 sensible enough to apply, and so I’ve just pushed it as f9dcc3d with a tweaked
 commit message.

> You’ve also been added to the list of TINYCHANGE contributors on
 <https://orgmode.org/worg/contributors.html>. If you submit more than 20
 cumulative lines of non-trivial code, you’ll need to get FSF assignment.

> Thanks for sharing the issue and making a patch for it 🙂 hopefully we’ll see
 you around in the future.


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

end of thread, other threads:[~2021-11-30  6:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <388850760.3644614.1634354740816.ref@mail.yahoo.com>
2021-10-16  3:25 ` Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html Sun Lin
2021-10-18  1:39   ` Sun Lin
2021-10-18  5:07     ` Bastien Guerry
2021-10-20 12:02       ` Sun Lin
2021-11-18  5:42         ` Sun Lin
2021-11-18  7:38   ` Timothy
2021-11-18  7:47     ` Sun Lin
2021-11-30  1:41       ` Sun Lin
2021-11-30  4:18         ` Timothy
2021-11-30  6:05           ` Sun Lin

Code repositories for project(s) associated with this 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).