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: Wed, 19 Jan 2022 23:54:43 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 18/01/2022 20:30, Ihor Radchenko wrote:
Dejan Josifović writes:

But, since ob-plantuml already had variable for arguments for executable
it fells natural to me to have customizable variables for when using
jar. These headers are of course easier, but the user would have to
write them on each source block to achieve something that should be
globally customizable (like charset).

FYI, you can customise any header arg globally. See manual page 16.3
Using Header Arguments.

info "(org) Using Header Arguments" https://orgmode.org/manual/Using-Header-Arguments.html

#!/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:
--- >8 ----
if [ -n "${JAVA_HOME}" ] && [ -x "${JAVA_HOME}/bin/java" ] ; then
    JAVA="${JAVA_HOME}/bin/java"
elif [ -x /usr/bin/java ] ; then
    JAVA=/usr/bin/java
else
    echo Cannot find JVM
    exit 1
fi

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

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.

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.

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.




reply via email to

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