emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can you automatically noweb include?


From: William McCoy
Subject: Re: Can you automatically noweb include?
Date: Fri, 7 Aug 2020 11:39:54 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

This use of :prologue appeared to me to be very useful.  But for some reason when I try it out it does not work for me.  I just get a message that the code block produced no output and that 'np' is not defined.  Just to check, when I put the import statements directly within my code block it works fine.

I am running:  Org mode version 9.3.7 (9.3.7-16-g521d7f-elpa

Any idea what I'm doing wrong?


On 8/6/20 2:12 PM, Ken Mankoff wrote:
Actual example:


* Prologue test
:PROPERTIES:
:header-args:python+: :prologue "import numpy as np; import os"
:END:

#+BEGIN_SRC python :results output
print(np.__version__)
#+END_SRC

#+RESULTS:
: 1.18.4




On Wed, Aug 5, 2020 at 3:03 PM Ken Mankoff <mankoff@gmail.com> wrote:
What about using :pre or :prologue and setting it at the header or document level?

Please excuse brevity. Sent from tiny pocket computer with non-haptic-feedback keyboard.

On Wed, Aug 5, 2020, 14:22 George Mauer <gmauer@gmail.com> wrote:
Use case:

I'm using ob-racket but this would apply just as well to a few other workflows I have with python or js.

I would like to write a helper function in a src block and then automatically have access to it in other src blocks further down the document. I don't really want a stateful session (nor does ob-racket support sessions) so I essentially want the equivalent of automatically including it everywhere so I don't have to type it out all the time (and have it screw up syntax coloring/indentation).

Is this currently possible? Does anyone have any ideas for how to extend things so it is?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]