From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mA3xIvZ1LV8fewAA0tVLHw (envelope-from ) for ; Fri, 07 Aug 2020 15:40:38 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id KBXvHvZ1LV8oMAAAB5/wlQ (envelope-from ) for ; Fri, 07 Aug 2020 15:40:38 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F26E39403D2 for ; Fri, 7 Aug 2020 15:40:37 +0000 (UTC) Received: from localhost ([::1]:46554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k44Tz-0005B5-MI for larch@yhetil.org; Fri, 07 Aug 2020 11:40:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k44TP-0005Aw-NI for emacs-orgmode@gnu.org; Fri, 07 Aug 2020 11:39:59 -0400 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:41974) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k44TO-0004Th-1y for emacs-orgmode@gnu.org; Fri, 07 Aug 2020 11:39:59 -0400 Received: by mail-qk1-x731.google.com with SMTP id l64so2080632qkb.8 for ; Fri, 07 Aug 2020 08:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=Uc8z25iGzfVAtUgdufb0NrLtaY8rW1FklWcMzbVJX8A=; b=N0yrYSUbKls7hrfSscEG5Y4JR2kM+t0STXAVync3QmEluUUMM3UA2JZGElW31wuVPX 1hD73ZHA3IFMTsHLqPnGeyXJrigQTWhQrhZtcf3qkVW2V7SjRVHrGHML65+51L9fsb6U n96Fty85DPWiOCxT4jfWUEzaBYipvyTjLy8506c+cblEkwnP/GYAVZZXZ2Y/IdOLjkyC 6rI0QZSfqtHVURtrpndmW7t+jSP5oPu678qfwSUqFV+gB1qR/TlZ+YiiSRrDFgBDd534 qGx+mzkSrPvFYA8nTOOhsYzmSnwGA6U4AIH2mcXmDv/MTSwLR4ee0v9h3FeQhx4NgAWS hU/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=Uc8z25iGzfVAtUgdufb0NrLtaY8rW1FklWcMzbVJX8A=; b=JVXsMx7Gfg2uKIZy2IJYYvJv5A976UDZnPXTES/YxLOFd7Sm/D1Fllr+KZlqPF6vVd U/WTcrh0OfuUxXWMPsF59IWyQH+jSTjOMB7fbMMmgMiO4EbAVePQnZtYFqfWPtxHB+qY jxiXFfFpQhhGkWaHdcwQj+iFFxnAFvG5/mQ5f2LEP1ydqQ6pRQ4aCu8gzz1MNWqR0lnm 3eM77pCtArxY2OoIB62Ke+DpbO7+xAZlAgtOapC+Z99SzNlISxyelgR5t5xF+1Evb/0q 97P22GeVU9HAUhLYwVvuB5iGMKueLWSZgq19nPrhzq2SZYIkeQHeDTMRL9xcuLDHoo70 N6Cw== X-Gm-Message-State: AOAM531Wt2AlxpuqLH6z5tggQsEq19dn/uRV/8ySOm/N1Hv2yN6JtFFb 3NooPVg85zZF8FEgnC9kPrv+efwi X-Google-Smtp-Source: ABdhPJwF5IHcJbymub5oP9hfiJgAMNyyTHieoFHgMg8sUQhCTQ/eFlCZcNHTWoT40O3wq9SShIXD0w== X-Received: by 2002:a37:a98c:: with SMTP id s134mr13922245qke.397.1596814795754; Fri, 07 Aug 2020 08:39:55 -0700 (PDT) Received: from [192.168.1.12] (c-174-63-121-12.hsd1.ma.comcast.net. [174.63.121.12]) by smtp.googlemail.com with ESMTPSA id p202sm6574563qke.97.2020.08.07.08.39.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Aug 2020 08:39:55 -0700 (PDT) Subject: Re: Can you automatically noweb include? To: emacs-orgmode@gnu.org References: From: William McCoy Message-ID: 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 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------1703BF927DA8BE9CF7F99FE2" Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=wdm8588@gmail.com; helo=mail-qk1-x731.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=N0yrYSUb; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.71 X-TUID: NnKmllAejpg4 This is a multi-part message in MIME format. --------------1703BF927DA8BE9CF7F99FE2 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 > 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 > 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? > --------------1703BF927DA8BE9CF7F99FE2 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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?

--------------1703BF927DA8BE9CF7F99FE2--