emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Babel: Store script in external file


From: Berry, Charles
Subject: Re: Babel: Store script in external file
Date: Tue, 17 Dec 2019 18:08:01 +0000


> On Dec 16, 2019, at 1:53 PM, Michael Gauland <address@hidden> wrote:
> 
> I've just started playing with #+INCLUDE, so I may not be using it correctly, 
> but this works for me.

Indeed, if what the OP wants is to wrap just that code as a src block and 
export it and any results it produces during export then that is the way to go. 

However, `org-babel-execute-buffer' , `org-babel-tangle' and so on will not 
honor the #+INCLUDE directive unless an export is in progress.

HTH,

Chuck

> 
> I have a file 'sh_test', which looks like:
> for i in $(seq 10); do
>     echo $i
> done
> 
> My org file:
> #+HEADER: :exports both
> #+INCLUDE: "sh_test" src sh
> 
> And the results:
> 
> ,----
> | for i in $(seq 10); do
> |     echo $i
> | done
> `----
> 
>   1
>   2
>   3
>   4
>   5
>   6
>   7
>   8
>   9
>  10
> 
> Hope that helps.
> 
> Kind regards,
> Mike
> 
> 
> On Mon, Dec 16, 2019 at 2:22 PM Nathan Neff <address@hidden> wrote:
> Hello all,
> 
> I think I'm missing something basic:  I'd like to have something like this:
> 
> #+begin_src python
> #+filename: foo.py
> 
> Instead of storing my Python code in the current org file, I would like
> Babel to read foo.py and execute it, as if it was inside the .org file.
> 
> The foo.py mentioned above is fairly large, and I would like the code
> to be stored in a different file than my .org file, for brevity.
> 
> Any ideas?  I feel like I'm missing something obvious.
> 
> Thanks,
> --Nate





reply via email to

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