On 23/10/2023 18:18, Florin Boariu wrote:

sh-5.1$ flatpak-spawn --host toolbox run /usr/bin/ditaa /tmp/foo.txt -o /tmp/foo.png


I really _need_ to generically execute a command.

I hope, a couple of workarounds are still possible.

1. Get java command by adding bash -x (or /usr/bin/bash, or "/usr/bin/env bash")

    flatpak-spawn --host toolbox run bash -x /usr/bin/ditaa \
        /tmp/foo.txt -o /tmp/foo.png

- set `org-babel-ditaa-java-cmd' to something like
    "flatpak-spawn --host toolbox run /usr/bin/java",
- set `org-ditaa-jar-path' to path to ditaa.jar reported by the command above, - add other options to either `org-babel-header-args:ditaa' :java property or to `org-babel-ditaa-java-cmd' - perhaps add /usr/bin/env JAVA_HOME=... and other required environment variables before java binary.

- set `org-babel-ditaa-java-cmd' to
  "flatpak-spawn --host toolbox run /usr/bin/ditaa".
- set `org-ditaa-jar-option' to empty string.
- Call of `shell-quote-argument' makes it impossible to set `org-ditaa-jar-path' to empty string, so set the following variables to some harmless value, e.g. "-Dfile.encoding=UTF-8" (anything added through :java babel header argument):
  + `org-ditaa-jar-path'
  + `org-ditaa-eps-jar-path'

I agree that it should be possible to call ditaa executable directly. Perhaps it is not possible because for a long time ditaa.jar was a part of Org mode repository (there were a lot of messages against dropping of jar files from the repository). It seems, nobody is ready to take responsibility and to become maintainer of ob-ditaa.el while active users have no ability to install ditaa as a package, so they anyway have to download .jar from upstream.

I find it tedious to add "flatpak-spawn ..." to every tool used by Emacs. Who is the publisher of the flatpak? I would expect a directory with symlinks named ditaa, java, git, gcc, cpp, etc to a script line

exec flatpak-spawn --host toolbox run /usr/bin/env "$0" "$@"

(or "$(basename "$0")")

mounted to flatpak runtime and added to $PATH. Perhaps another approach exist and it should be discussed with the packager and Emacs developers.

Reply via email to