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: Ihor Radchenko
Subject: Re: [PATCH] ob-plantuml: Allow setting PlantUML args for jar file
Date: Fri, 21 Jan 2022 20:48:58 +0800

Max Nikulin <manikulin@gmail.com> writes:

>> #!/bin/bash
>> gjl_package=plantuml
>> gjl_jar="plantuml.jar"
>> source /usr/share/java-config-2/launcher/launcher.bash
>
> It seems with with the suggested patch both -Djava.awt.headless=true and 
> -headless are passed to jar. I suspect it is either redundant or 
> launcher.bash converts "-headless" to "-Djava.awt.headless=true". In 
> ubuntu there is no room for special treatment of "-headless" option by 
> the shell wrapper:

It is redundant, but should not cause any harm. plantuml source code has:

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

I can of course add a condition to not add -headless if we are running
jar, but I do not see much benefit except purity argument.

>> I feel that running headless mode in the ob-plantuml is deliberate.
>
> https://plantuml.com/faq
> "Basically, this is because PlantUML needs to have access to some 
> graphical resources"
>
> I have no idea what is actually affected.

It mostly looks like otherwise there are some harmless warnings in the
output. 

> Which peace of code (java or plantuml.jar) handles "-headless" option? 
> This question affects decision if jar and executable wrapper modes may 
> share same list of arguments. Plantuml site recommends namely 
> -Djava.awt.headless=true. Anyway with or without the patch, 
> "-Djava.awt.headless=true" is added unconditionally in the jar mode. I 
> would revert that patch and either add it to java header argument or to 
> a new defcustom.

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.

> Are there cases when :cmdline header argument is not enough and extra 
> custom variable org-plantuml-args (org-plantump-executable-args) should 
> be used?

> Actually I have realized that I do not understand why babel code uses 
> mix of defcustom and header arguments. The latter are more flexible and 
> may be adjusted per source block. On the other hand they may be set in 
> init file. Even java executable and path to jar file may be obtained 
> from header arguments.

Good questions. I think that the main reason is that most of header args
are not merged - only the last value is used. If you define :cmdline in
source block, it will override system-wide settings. Having an
additional defcustom allows to provide a "permanent" set of parameters -
to be used no matter what.

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?

Best,
Ihor






reply via email to

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