From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Berry, Charles" Subject: Re: Babel: Store script in external file Date: Tue, 17 Dec 2019 18:08:01 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:38354) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihHH9-0006HY-Kz for emacs-orgmode@gnu.org; Tue, 17 Dec 2019 13:08:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihHH7-00005X-Vx for emacs-orgmode@gnu.org; Tue, 17 Dec 2019 13:08:50 -0500 Received: from mx0b-00395d01.pphosted.com ([148.163.137.170]:32616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ihHH7-0008VC-D5 for emacs-orgmode@gnu.org; Tue, 17 Dec 2019 13:08:49 -0500 In-Reply-To: Content-Language: en-US Content-ID: 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: Michael Gauland Cc: emacs-orgmode > On Dec 16, 2019, at 1:53 PM, Michael Gauland wrote: >=20 > I've just started playing with #+INCLUDE, so I may not be using it correc= tly, but this works for me. Indeed, if what the OP wants is to wrap just that code as a src block and e= xport it and any results it produces during export then that is the way to = go.=20 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 >=20 > I have a file 'sh_test', which looks like: > for i in $(seq 10); do > echo $i > done >=20 > My org file: > #+HEADER: :exports both > #+INCLUDE: "sh_test" src sh >=20 > And the results: >=20 > ,---- > | for i in $(seq 10); do > | echo $i > | done > `---- >=20 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > 10 >=20 > Hope that helps. >=20 > Kind regards, > Mike >=20 >=20 > On Mon, Dec 16, 2019 at 2:22 PM Nathan Neff wrote= : > Hello all, >=20 > I think I'm missing something basic: I'd like to have something like thi= s: >=20 > #+begin_src python > #+filename: foo.py >=20 > 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. >=20 > 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. >=20 > Any ideas? I feel like I'm missing something obvious. >=20 > Thanks, > --Nate