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

2022-01-21 Thread Dejan Josifović

On 19-Jan-22 17:54, Max Nikulin wrote:

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


Thanks for the info. I'm still not fully proficient in org-mode so this 
(and the discussion) is very helpful.


On 18-Jan-22 14:30, Ihor Radchenko wrote:

I am not sure about this specific case. The PlantUML executable is
literally a wrapper around java call to jar. Below is the contents of
plantuml file in my system:

#!/bin/bash
gjl_package=plantuml
gjl_jar="plantuml.jar"
source /usr/share/java-config-2/launcher/launcher.bash

Unless it is any different on your side, the arguments for jar and
executable should be literally the same.


I see your point here - no need for redundant custom variables.


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?


This is very interesting, I will keep an eye on this discussion to 
follow up on everything. :-)


Thanks.

Regards,

--
Dejan Josifović | Дејан Јосифовић
Software engineer | Софтверски инжењер
https://theparanoidtimes.org

()  ascii ribbon campaign
/\  www.asciiribbon.org



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

2022-01-17 Thread Dejan Josifović

On 16-Jan-22 08:53, Max Nikulin wrote:

Dejan, have you tried :java or :cmdline header arguments?


Hi Max! Yes, I have tried with those header arguments and they naturally 
work. Maybe I should've mentioned that.


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


On 15-Jan-22 07:20, Ihor Radchenko wrote:

See the attached patch. It appears that we can simply carry over the
executable args to jar (but please test it on other systems!)

I have tested the patch on my machine and it works fine. I have set
the new/renamed variable like this:
(setq org-plantuml-args (list "-headless" "-charset" "UTF-8"))

and tried the same example:

#+BEGIN_SRC plantuml :file ./test.png
  A -> B: Hello ∧
#+END_SRC

and it renders correctly.
However, I have a couple of concerns.

I second the concern that Max stated:

Is there a case when some arguments are suitable for dedicated binary but 
should be avoided for jar (when a user has both executable from system package 
and manually downloaded jar having newer version)? It may be a reason to have 
separate variables (or header arguments).
I believe it is better design decision to separate arguments for 
executable and jar.


Since we are making jar arguments customizable, we should think about 
adding java arguments customizable (also mentioned by Max!). This line 
in patch:

+   "-Djava.awt.headless=true"
can be also added to a separate variable.

Lastly, there is a typo in the patch:
+** Removed or renamed functions and variables
+*** =org-plantump-executable-args= is renamed and applies to jar as well
+
+The new variable name is =org-plantump-args=.  It now applies to both
+jar PlantUML file and executable.
Word plantump should be plantuml I guess. :-)

Thanks all,

--
Dejan Josifović | Дејан Јосифовић
Software engineer | Софтверски инжењер
https://theparanoidtimes.org

()  ascii ribbon campaign
/\  www.asciiribbon.org


OpenPGP_signature
Description: OpenPGP digital signature


Re: ob-plantuml: Proposal to add 'jar-args' customizable variable

2022-01-10 Thread Dejan Josifović

On 09-Jan-22 18:46, Andy Moreton wrote:

I use this snippet to set the ob-plantuml.el args to match the
plantuml-mode.el settings:

   (setf (alist-get :javaorg-babel-default-header-args:plantuml)
 (mapconcat #'identity plantuml-java-args " ")
 (alist-get :cmdline org-babel-default-header-args:plantuml)
 (mapconcat #'identity plantuml-jar-args " "))

Hope that helps,

 AndyM


Hi AndyM,

This is actually very helpful It didn't remotely cross my mind to do 
something like this. Thanks a bunch! I was using PlantUML from shell to 
create images to bypass this until now.


Of course, a native solution in babel for this is always better.

Looking at this, I see that in my initial post I made an argument only 
for arguments passed to PlantUML jar, but now I see that the same can be 
applied for arguments passed to java command/process. Both are 
customizable in plantuml-mode, but not in ob-plantuml. Maybe we should 
think about adding a separate var for those also.


Regards,

--
Dejan Josifović | Дејан Јосифовић
Software engineer | Софтверски инжењер
https://theparanoidtimes.org

()  ascii ribbon campaign
/\  www.asciiribbon.org


OpenPGP_signature
Description: OpenPGP digital signature


Re: ob-plantuml: Proposal to add 'jar-args' customizable variable

2022-01-08 Thread Dejan Josifović

On 07-Jan-22 05:38, Ihor Radchenko wrote:

Dejan Josifović  writes:


I has been a little over a month since i posted this to the mailing
list, so I'm trying to bump it.


Added to todo list. It may take a little while, but I will take a look
at it relatively soon.

Best,
Ihor


Thanks Ihor!

Mail me if you need more info.

Regards,

--
Dejan Josifović | Дејан Јосифовић
Software engineer | Софтверски инжењер
https://theparanoidtimes.org

()  ascii ribbon campaign
/\  www.asciiribbon.org


OpenPGP_signature
Description: OpenPGP digital signature


Re: ob-plantuml: Proposal to add 'jar-args' customizable variable

2022-01-06 Thread Dejan Josifović

On 03-Dec-21 23:56, Dejan Josifović wrote:

Hi all,

I use PlantUML integration in org-mode for years now, but only
recently I came across some unwanted behavior.

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. However,
trying this from a standalone file using plantuml-mode[1], the end image 
rendered correctly. Here is some sample code which can reproduce the issue:


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

Comparing ob-plantuml.el and plantuml-mode.el files I found what is the 
problem. plantuml-mode has a customizable variable for specifying 
arguments when using PlantUML from jar (plantuml-jar-args (list 
"-charset" "UTF-8" ). The charset arguments is what is needed for

the images to render correctly (I confirmed it by implementing it locally).

I was wondering why such variable doesn't exist in ob-plantuml. I have
searched the mailing list archives, confirmed bugs and help page and 
couldn't find anything related.


Does anyone from the community know if such variable was deliberately 
omitted? If so, what is the reason?


If this is indeed a wanted feature, I will be more than happy to provide 
a patch.


[1] https://github.com/skuro/plantuml-mode

Thanks and regards,



Hi all,

I has been a little over a month since i posted this to the mailing 
list, so I'm trying to bump it.


Thanks all.

Regards,

--
Dejan Josifović | Дејан Јосифовић
Software engineer | Софтверски инжењер
https://theparanoidtimes.org

()  ascii ribbon campaign
/\  www.asciiribbon.org


OpenPGP_signature
Description: OpenPGP digital signature


ob-plantuml: Proposal to add 'jar-args' customizable variable

2021-12-03 Thread Dejan Josifović

Hi all,

I use PlantUML integration in org-mode for years now, but only
recently I came across some unwanted behavior.

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. However,
trying this from a standalone file using plantuml-mode[1], the end image 
rendered correctly. Here is some sample code which can reproduce the issue:


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

Comparing ob-plantuml.el and plantuml-mode.el files I found what is the 
problem. plantuml-mode has a customizable variable for specifying 
arguments when using PlantUML from jar (plantuml-jar-args (list 
"-charset" "UTF-8" ). The charset arguments is what is needed for

the images to render correctly (I confirmed it by implementing it locally).

I was wondering why such variable doesn't exist in ob-plantuml. I have
searched the mailing list archives, confirmed bugs and help page and 
couldn't find anything related.


Does anyone from the community know if such variable was deliberately 
omitted? If so, what is the reason?


If this is indeed a wanted feature, I will be more than happy to provide 
a patch.


[1] https://github.com/skuro/plantuml-mode

Thanks and regards,

--
Dejan Josifović | Дејан Јосифовић
Software engineer | Софтверски инжењер
https://theparanoidtimes.org

()  ascii ribbon campaign
/\  www.asciiribbon.org