I would likeRegarding my initial goal, which was to settle for a solution like the following for now:
(defun my/org-babel-plantuml-header-args ()
"Set dynamic header arguments for PlantUML source blocks."
(let ((output-dir (org-attach-dir-get-create)))
`((:results . "file link")
(:output-dir . ,output-dir)
(:file-ext . "png")
(:exports . "results"))))
(setq org-babel-default-header-args:plantuml
(my/org-babel-plantuml-header-args))
I would have to set the file manually, but I wrote a simple snippet for conveniencediagram files created in the attachment directory, and most of my initial requirements would be fulfilleddisplayed in the buffer, it is not possible to achieve using the header default arguments.
UnfortunatelyAs @NickD commented, any function used there to set an option is only called once upon setting the (org-attachbabel-dirdefault-getheader-create)args:plantuml
function is called on Doom Emacs startup which causes errors and some destructive editing of my literatevariable. This approach even had other adverse effects as I am using an org config file. The
I managed to achieve the same results by using a custom function in a Yasnippet snippet to build the output-dir
string. It works fine, just has a bit of a cluttered header.
Sorry if this thread is tryinga bit all over the place. If future readers are looking to createachieve the same kind of thing, I would gladly share the snippet code, and the custom hook function to set the attachment tag to the appropriate org node. I am not posting it because it uses Org-roam which is a property drawer with an ID fieldniche use case I think, and I think it is off-topic considering how the thread started.