I would like to execute a python code block to produce new headlines (i.e. modify the current org file programmatically). If I produce raw results with a replace
argument, the replace
argument seems to be inactive in this case. For example, if I run 3 times the following code block:
#+name: test_block
#+begin_src python :results output raw replace
print("* Test")
#+end_src
the obtained result is:
#+RESULTS: test_block
* Test
* Test
* Test
And I would expect only one * Test
line with the replace
argument. The code works as expected if I remove the raw
argument (but there is a :
before the headline (* test
) which is not a headline anymore).
drawer
instead ofraw
: withraw
, Org mode does not know where the results end and so it does not know what to erase.