For what its worth, I maintain (well maintain is a big word when I'm also probably the only person to use it) this fork of xchrishawk/ob-racket: https://github.com/togakangaroo/ob-racket It seems to have more features than the wallyqs one supporting :var headers. I can look at how prologue support works in others and add it, but I also am surprised that this is up to the plugin authors *at all*. As you pointed out, that means that it can't possibly support noweb expansion On Fri, Aug 7, 2020 at 11:47 PM Tom Gillespie wrote: > After a bit of investigation, it seems that wallyqs implementation of > ob-racket does not treat/manage :prologue arguments correctly, which > is worrying because I would assume that the semantics for how prologue > works should not be something that could be accidentally broken by > ob-* implementations (but that is a separate issue). More relevant to > this thread is that python the prologue works as others have reported, > but if you include a noweb reference in the prologue it does not get > expanded. It is quite possible that this should be considered a bug > since it means that prologues are added only after the main block is > expanded. This seems incorrect, and I suspect that it is another bug > related to the one fixed in df5a83637518ad9aa586d49884a6271f11afc592 > (discussion here > > https://orgmode.org/list/CA+G3_PNi3uMvBiWgBdKuC3C6VJt1T1j-RKH43LRqYbr+4NS8ZA@mail.gmail.com/ > ). > The fact that prologue is not expanded means that you can modify what > code is run by putting it in a prologue and org mode will be none-the > wiser. The sha1 changes if you set :cache yes, which means that > something in the execution code is doing something different than in > the block hashing code. Further investigation required. > > * Use the code > :PROPERTIES: > :header-args:python: :prologue "<>" > :END: > > #+name: python-helper > #+begin_src python > asdf = lambda : 'result' > #+end_src > > #+begin_src python :noweb yes > return asdf() > #+end_src > > On Fri, Aug 7, 2020 at 9:20 PM Tom Gillespie wrote: > > > > Hah, this is what I get for not reading carefully enough. I wonder if > > it is possible to stick <> in the prologue and have it > > expand. > > > > On Fri, Aug 7, 2020 at 9:18 PM Tom Gillespie wrote: > > > > > > I don't see a direct answer to the original question in the thread, so > > > here is an example of how I do it taken from > > > > https://raw.githubusercontent.com/SciCrunch/sparc-curation/master/docs/developer-guide.org > . > > > You can ctrl-f for racket-graph-helper to see the relevant blocks. A > > > reduced version is below. Recall that I use > > > https://github.com/wallyqs/ob-racket. I use this pattern all over the > > > place in my org blocks. Best, > > > Tom > > > > > > * Use the code > > > :cache yes" > > > #+begin_src racket :lang racket/base :noweb yes > > > <> > > > (helper-function "this should work") > > > #+end_src > > > > > > #+RESULTS: > > > : this should work hello world > > > > > > > > > * Define the helpers > > > #+name: racket-helper > > > #+header: :prologue "#lang racket/base" > > > #+begin_src racket :lang racket/base > > > (define (helper-function arg) > > > (string-append arg " hello world")) > > > #+end_src >