emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ob-plantuml: Allow setting PlantUML args for jar file
Date: Fri, 21 Jan 2022 20:48:58 +0800	[thread overview]
Message-ID: <87mtjpz22t.fsf@localhost> (raw)
In-Reply-To: <ss9fol$cmi$1@ciao.gmane.io>

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	other threads:[~2022-01-21 13:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 22:56 ob-plantuml: Proposal to add 'jar-args' customizable variable Dejan Josifović
2022-01-06 19:53 ` Dejan Josifović
2022-01-07  4:38   ` Ihor Radchenko
2022-01-08 13:14     ` Dejan Josifović
2022-01-09 17:46 ` Andy Moreton
2022-01-10 16:00   ` Dejan Josifović
2022-01-15  6:20 ` [PATCH] ob-plantuml: Allow setting PlantUML args for jar file Ihor Radchenko
2022-01-16  7:53   ` Max Nikulin
2022-01-17 17:19     ` Dejan Josifović
2022-01-18 13:30       ` Ihor Radchenko
2022-01-19 16:54         ` Max Nikulin
2022-01-21 12:48           ` Ihor Radchenko [this message]
2022-01-23 16:50             ` Max Nikulin
2022-05-08  6:48               ` Ihor Radchenko
2022-01-21 22:22           ` Dejan Josifović

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtjpz22t.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    --subject='Re: [PATCH] ob-plantuml: Allow setting PlantUML args for jar file' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).