emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [TASK] Allow customizeable ditaa executable in ob-ditaa.el


From: Leo Butler
Subject: Re: [TASK] Allow customizeable ditaa executable in ob-ditaa.el
Date: Fri, 10 Nov 2023 03:19:51 +0000
User-agent: Gnus/5.13 (Gnus v5.13)

On Thu, Nov 09 2023, Max Nikulin <manikulin@gmail.com> wrote:

> On 09/11/2023 10:17, Leo Butler wrote:
>> While I was reviewing the documentation, ob-doc-ditaa.org, and the
>> source, ob-ditaa.el, I realized that there is a simple way to run a
>> script file instead of a jar file.
>
>
> It is better to avoid obstacles than to document them.

Ok, I figured that would be the response.

> diff --git a/lisp/ob-ditaa.el b/lisp/ob-ditaa.el
> index fa864c7bc..4a2b09cd9 100644
> --- a/lisp/ob-ditaa.el
> +++ b/lisp/ob-ditaa.el
> @@ -100,11 +100,13 @@ (defun org-babel-execute:ditaa (body params)
>                      "epstopdf"
>                      " " eps-file
>                      " -o=" (org-babel-process-file-name out-file))))
> +        (jar (org-string-nw-p (if eps org-ditaa-eps-jar-path
> org-ditaa-jar-path)))
>          (cmd (concat org-babel-ditaa-java-cmd
> -                     " " java " " org-ditaa-jar-option " "
> -                     (shell-quote-argument
> -                      (expand-file-name
> -                       (if eps org-ditaa-eps-jar-path org-ditaa-jar-path)))
> +                     " " java
> +                     (and jar
> +                          (concat
> +                            " " org-ditaa-jar-option " "
> +                            (shell-quote-argument (expand-file-name jar))))
>                       " " cmdline
>                       " " (org-babel-process-file-name in-file)
>                       " " (if pdf-cmd
>
> should allow to set :java to
>
>     flatpak-spawn --host toolbox run /usr/bin/ditaa
>
> without abusing of org-ditaa-jar-path. Untested.

Doesn't this abuse the `java' header argument, which is intended to pass
arguments to the java runtime?

I think that it would be best to implement the change to mirror that
done in ob-plantuml, as Ihor suggested earlier. But, ob-plantuml uses a
customization switch: `org-plantuml-exec-mode'. Its documentation reads:

  Method to use for PlantUML diagram generation.
  `jar' means to use java together with the JAR.
  The JAR can be configured via `org-plantuml-jar-path'.
  
  `plantuml' means to use the PlantUML executable.
  The executable can be configured via `org-plantuml-executable-path'.
  You can also configure extra arguments via
  `org-plantuml-executable-args'.[fn:1] 

My reading of the documentation and ob-plantuml.el is that it is not
possible to use the `java' header argument in the way you propose for
ob-ditaa.el.

Leo

[fn:1] (Aside: `org-plantuml-executable-args' should be `org-plantuml-args';
Ihor missed it when he made the change in commit b5f0efc049).


reply via email to

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