From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Gauland Subject: Re: Babel: Store script in external file Date: Tue, 17 Dec 2019 10:53:51 +1300 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ea347f0599d93f44" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56799) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igyJZ-0001am-DE for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 16:54:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igyJY-0001Wi-9e for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 16:54:05 -0500 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:41080) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igyJY-0001Tc-3q for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 16:54:04 -0500 Received: by mail-io1-xd2b.google.com with SMTP id c16so8716101ioo.8 for ; Mon, 16 Dec 2019 13:54:03 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nathan Neff Cc: emacs-orgmode --000000000000ea347f0599d93f44 Content-Type: text/plain; charset="UTF-8" I've just started playing with #+INCLUDE, so I may not be using it correctly, but this works for me. 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 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 > --000000000000ea347f0599d93f44 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've just started playing with #+INCLUDE, so I may not= be using it correctly, but this works for me.

I have a file 'sh= _test', which looks like:
for i in $(seq 10); do
=C2=A0 =C2=A0 echo $i=
done

My org file:
#+HEADER: :exports both
#+INCL= UDE: "sh_test" src sh

And the results:

,----
| for i in $(seq 10); do
| =C2=A0 =C2=A0 echo $i
| do= ne
`----

=C2=A0 1
=C2=A0 2
=C2=A0 3
=C2=A0 4
=C2=A0 5=
=C2=A0 6
=C2=A0 7
=C2=A0 8
=C2=A0 9
=C2=A010

Hope that helps.
<= span style=3D"font-family:monospace">
Kind regards,
Mike


<= div class=3D"gmail_quote">
On Mon, Dec= 16, 2019 at 2:22 PM Nathan Neff <nathan.neff@gmail.com> wrote:
Hello all,

= I think I'm missing something basic: =C2=A0I'd like to have somethi= ng like this:

#+begin_src python
#+filen= ame: foo.py

Instead of storing my Python code in t= he current org file, I would like
Babel to read foo.py and execut= e it, as if it was inside the .org file.

The foo.p= y mentioned above is fairly large, and I would like the code
to b= e stored in a different file than my .org file, for brevity.

=
Any ideas?=C2=A0 I feel like I'm missing something obvious.<= /div>

Thanks,
--Nate
--000000000000ea347f0599d93f44--