Hello Rudy,
thank you very much for verifying the issue.
I am very new to this so I hope this is what you mean.
I created a patch using the patch command for ob-plantuml.el (attached – I
guess I could have done the same directly in emacs as well). Could you have a
quick look at it?
I haven't written a test yet in/for Emacs. I will try to learn this next. But
for now I don't have a test ready.
Best
Tim
On 13 Sep 2025, at 16:52, Rudolf Adamkovič wrote:
> "Dr. Arne Babenhauserheide" arne_...@web.de writes:
>
>> #+begin_src plantuml :var replace_me="this is variable content" :file
>> /tmp/filei.png
>> @startuml
>> "replace_me"
>> @enduml
>> #+end_src
>
> Like the OP, I too am on MacOS (15.5). Further, I am running fresh Org
> from main' (69b891b59) and fresh Emacs from master' (307405a72c4). I
> get "replace_me" in the output, instead of "this is variable content".
> I can also confirm that the suggested code changes fix the problem.
>
> Tim, could you perhaps resubmit your code as a Git patch, ideally with
> at least one test, so that we do not chase our tail next time?
>
> Rudy
>
> "I do not fear death. I had been dead for billions and billions of years
> before I was born, and had not suffered the slightest inconvenience from it."
> --- Mark Twain, paraphrased
>
> Rudolf Adamkovič rud...@adamkovic.org [he/him]
> http://adamkovic.org
--- a/lisp/ob-plantuml.el
+++ b/lisp/ob-plantuml.el
@@ -104,11 +104,23 @@
If BODY does not contain @startXXX ... @endXXX clauses, @startuml
... @enduml will be added."
- (let ((full-body
- (org-babel-expand-body:generic
- body params (org-babel-variable-assignments:plantuml params))))
- (if (string-prefix-p "@start" body t) full-body
- (format "@startuml\n%s\n@enduml" full-body))))
+ (let ((assignments (org-babel-variable-assignments:plantuml params)))
+ (if
+ (or (string-prefix-p "@start" body t)
+ (string-prefix-p "\\@start" body t))
+ (if assignments
+ (let*
+ ((lines (split-string body "\n")) (first-line (car lines))
+ (rest-lines (cdr lines))
+ (assignment-lines (mapconcat 'identity assignments "\n"))
+ (clean-first-line
+ (replace-regexp-in-string "\\\\@" "@" first-line)))
+ (concat clean-first-line "\n" assignment-lines
+ (when rest-lines
+ (concat "\n" (mapconcat 'identity rest-lines "\n")))))
+ body)
+ (let ((full-body (org-babel-expand-body:generic body params
assignments)))
+ (format "@startuml\n%s\n@enduml" full-body)))))
(defun org-babel-execute:plantuml (body params)
"Execute a block of plantuml code with org-babel.