emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ob-plantuml: Allow setting PlantUML args for jar file


From: Max Nikulin
Subject: Re: [PATCH] ob-plantuml: Allow setting PlantUML args for jar file
Date: Sun, 23 Jan 2022 23:50:42 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 21/01/2022 19:48, Ihor Radchenko wrote:
Max Nikulin writes:

I have reordered some parts of your message

I do not see much point customising this particular argument. We _do
not_ want plantuml in gui mode. Ever. Otherwise, babel behaviour will be
unpredictable. If we make it customizeable, the only "benefit" would be
allowing users to shoot their own leg.

I have tried plantuml and it does not start in GUI mode unless -gui option is specified. I admit it might be not so kind in the past. If you mean the following thread

Sun Lin. Subject: [PATCH] Fix DISPLAY error on exporting org with plantuml to html. Sat, 16 Oct 2021 03:25:40 +0000 (UTC) https://list.orgmode.org/388850760.3644614.1634354740816@mail.yahoo.com/

than it is some strange use case. A lot of applications behave incorrectly when DISPLAY environment variable has invalid value. So it is responsibility of the user to reset it. On the other hand I believe that nobody is still using e.g. remote font server and headless mode might be a bit more reproducible (e.g. screen dpi can not affect result).

Actually you patch makes headless mode customizable and I do not consider it as shooting somebody's foot:

+(defcustom org-plantuml-args (list "-headless")

So in my opinion dropping "-Djava.awt.headless=true" is just a step to more consistent behavior for jar/wrapper modes.

if (argsArray.length > 0 && argsArray[0].equalsIgnoreCase("-headless")) {
                        System.setProperty("java.awt.headless", "true");
                }

Thank you it makes thing more clear. By the way, latest wrapper in ubuntu has the following code

---- >8 ----
HEADLESS=
[ -z "$DISPLAY" ] && HEADLESS=-Djava.awt.headless=true

$JAVA -Djava.net.useSystemProxies=true $HEADLESS -jar /usr/share/plantuml/plantuml.jar "$@"
---- 8< ----

I realise that the current situation is kind of awkward. Maybe we should
encourage ob-* libraries to use special header args instead of
defcustoms and modify built-in libraries in this spirit. Would you be
interested to write a feature request?

I do not have clear vision how it should work yet. I am afraid that even if I were dump current state of ideas, they would be lost and nobody would remind about them when the question would be risen next time.

I do not object concerning common `org-plantuml-args' variable. Earlier I had in mind that user might have incompatible versions of plantuml installed as executable wrapper and available as another jar. Separate args variable might make it easier to switch between wrapper/jar modes. I do not think it is a case that must be supported, anyway it is currently impossible to switch mode through header arguments, e.g. to demonstrate version difference.

On 15/01/2022 13:20, Ihor Radchenko wrote:
Dejan Josifović writes:

Using PlantUML from jar (org-plantuml-jar-path variable) and latest org-mode, I wanted to render a diagram containing some Unicode characters (such as '⊥' and '∀'), but the end image had some gibberish instead.

#+BEGIN_SRC plantuml :file ./test.png
A -> B: ∀ characters display correctly is ⊥
#+END_SRC

FYI, I am unable to reproduce it on my system.

Default charset depends on locale:

LANG=C plantuml -h | grep charset
    -charset xxx        To use a specific charset (default is US-ASCII)

plantuml -h | grep charset
    -charset xxx        To use a specific charset (default is UTF-8)

echo $LANG
en_US.UTF-8

To wrap up, I suggest (and I do not insist) to drop "-Djava.awt.headless=true" since "-headless" is anyway added in jar mode. Those who desperately need namely "-Djava.awt.headless=true" (for some unknown to me reason) may customize :java header argument. I do not see any real problem with the change, just a minor improvement.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]