I use org-mode to tangle code blocks in programming languages such as python into their respective code files. But I am not sure how to tangle ditaa code blocks and execute them to generate figures outside emacs.
I tried to add the
:tangle tag as follows:
#+begin_src ditaa :file ./some.png :tangle tangled.ditaa :comments link :cmdline -E :exports results :results none ... #+end_src
But, nothing gets tangled into the designated file
What is the appropriate way to tangle and execute a ditaa code block in org mode?
(This is with Emacs 28 in Ubuntu 22.04 LTS.)
-- Edit --
There was a prompt when tangling the ditaa block, which was blocking the tangling process:
Type M-x picture-mode-exit in this buffer to return it to Fundamental mode. No comment syntax is defined. Use:
If I enter a random value such as
#, the block is tangled into a disk file.
Can I disable this behavior, since there is no comment in my ditaa blocks?
Also, the tanged file does not seem to remember the
:file ./some.png tag, and when executed with
ditaa tangled.ditaa, just generates a file with default name
How can I make the tangled ditaa file output to the same image file as described in the original org mode file?
.ditaafiles be opened in
picture-modethrough an entry in
auto-mode-alist. What happens if you open
tangled.ditaain emacs? For the second question, there is no place in the ditaa file where the output filename is stored. By default, if you run
tangled.ditaa, you are going to get
tangled.png- it keeps the stem and changes the extension. You can run
ditaa tangled.ditaa some.pngto produce a differently name output file, but there's nothing that Org mode can do about that: you got to do that manually.
What happens if you open tangled.ditaa in emacs?. I see the ditaa file content as text in "Fundamental" mode. On the second point, I was trying to automate the tangling process and had hope to get the tangled code behave the same way as the code block. But I guess I can hard-code the filenames.
picture-modeat some point in the tangling, so maybe you can
picture-modefunction, so that the processing will stop at that point and you can get a backtrace with
dto see how exactly it got there.