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 QKrfEhsnLl9BCwAA0tVLHw (envelope-from ) for ; Sat, 08 Aug 2020 04:16:27 +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 30ipDhsnLl/nbwAAB5/wlQ (envelope-from ) for ; Sat, 08 Aug 2020 04:16:27 +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 5FC02940539 for ; Sat, 8 Aug 2020 04:16:26 +0000 (UTC) Received: from localhost ([::1]:43646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k4GHP-0005Sc-DD for larch@yhetil.org; Sat, 08 Aug 2020 00:16:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k4GH2-0005SI-0D for emacs-orgmode@gnu.org; Sat, 08 Aug 2020 00:16:00 -0400 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]:41621) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k4GGz-0005ZK-Qu for emacs-orgmode@gnu.org; Sat, 08 Aug 2020 00:15:59 -0400 Received: by mail-oi1-x22f.google.com with SMTP id b22so3836038oic.8 for ; Fri, 07 Aug 2020 21:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to; bh=08Rd7oEuamjzMBs/2SI0AoFhoKBWRmSlqgPioddnlX4=; b=JFeuQ7GgiDF0201aHl5g2vxVGpCPBJuh+60nHTyCeimUlWwTKG52+YrY3ge3wAJn8k nUkgDp/2w01/OFGtNKRMiBydgHNsB6PtEVZXiNOCkz0zeo+64Tz+QRPQfqjPuSBcibtk Eij2VR01qq0ECWYuOG5qUEjDwcAsaP3GPTyLj1fmv3joIP4yW6FdI6AWP4wmbKmWI0we XOM8MGXEq0jRguzSr6hPMxeq+o9cgFmy12pSKOh8MjJZ23/6aLvkpWW6Mv7fxQheLOGQ EU09PGMvKBIhYrHxiCIlExbiOMAle88HEhndCNxJ6jryUt18H8dQ50KP1Wn1GUYJ87mk gYjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to; bh=08Rd7oEuamjzMBs/2SI0AoFhoKBWRmSlqgPioddnlX4=; b=EafoE7l5t5xgLRfbM/QcHKyZUgFJ1WP+vL25qzQ2Qi8wkfO9EKyQOrb2boBd7CmfHT 0ixIxk0hfgr6DNUI3123+yhEf21avd9RWrwrgbe8zCop99SuL9Hd+NYkydvho7gCpnKQ vluiN4sfTXFep6TFniAj/RcL3LkAdZwQn28nzOjN0E2srTPiMD6oNDmqiAvKEGFrj+7M 1iaQV/8Kk64l+zgUu0jNC1p+irdlSE8eCzRKjfJsZnv2IjqoCoZQ1PwRbXiADXl9qPBo Il7HFBjTrg45IjxWJZfoDt8RvDIgkVvqbaJbJSuLBZjRG2oZKSRuWYV+B+yiCJOio64p I2Bg== X-Gm-Message-State: AOAM532pVyx2HFlEoeKoBWg6bsA19smEC2IS05EGbqn1/OnFwiqkPgWF HhII7CnfAAvZ6Y5FiCKe9riuG+5YdPFe4EA8hMdcf0QF X-Google-Smtp-Source: ABdhPJwsbD/UWWR9h2FUPVo8RyHmJWUEc561tTXUbsJtTSIsxhTSTHwWh9ep0y/VKPrShuQ+Feq9OH84D2EQNFwQ4CQ= X-Received: by 2002:aca:1904:: with SMTP id l4mr14489226oii.67.1596860155441; Fri, 07 Aug 2020 21:15:55 -0700 (PDT) MIME-Version: 1.0 References: <3D721ED9-B51F-47D2-B2D4-7017FCA5F95C@health.ucsd.edu> <87k0yanohq.fsf@tsdye.online> <943BE6FC-05D6-4AFD-9A97-512B626822E2@health.ucsd.edu> In-Reply-To: From: George Mauer Date: Fri, 7 Aug 2020 23:15:44 -0500 Message-ID: Subject: Re: Can you automatically noweb include? To: org-mode mailing list Content-Type: multipart/alternative; boundary="000000000000523a7605ac55fa00" Received-SPF: pass client-ip=2607:f8b0:4864:20::22f; envelope-from=gmauer@gmail.com; helo=mail-oi1-x22f.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: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 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_FROM=0.001, HTML_MESSAGE=0.001, PDS_OTHER_BAD_TLD=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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: , Reply-To: gmauer@gmail.com 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=JFeuQ7Gg; 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: 1.79 X-TUID: RqVRwjS0XhOA --000000000000523a7605ac55fa00 Content-Type: text/plain; charset="UTF-8" Is there a straightforward way to have a multiline prologue? Or maybe use the body of named block as prologue? On Fri, Aug 7, 2020 at 5:02 PM William McCoy wrote: > Yes, of course, that was it! I ran into that issue a few months ago and > then I forgot about again! > > Thanks both for your help! > > Bill > > On 8/7/20 5:25 PM, Berry, Charles wrote: > > Good catch. Also it works if you put the property block at the very > beginning of the file. > > > > This sometimes helps: > > > > M-x org-lint RET > > > > which in this case reports "Incorrect contents for PROPERTIES drawer" > > > > which is a bit cryptic IMO, but does point to any issue with the > property. > > > > HTH, > > > > Chuck > > > >> On Aug 7, 2020, at 2:18 PM, Thomas S. Dye wrote: > >> > >> It works here if you remove the blank line between the headline and the > PROPERTIES block. > >> > >> William McCoy writes: > >> > >>> Chuck, > >>> > >>> Thanks very much for your response. I didn't know about those > options. When I > >>> use C-c C-v C-i, I get the following: > >>> > >>> Lang: python > >>> Properties: > >>> :header-args nil > >>> :header-args:python nil > >>> Header Arguments: > >>> :cache no > >>> :exports code > >>> :hlines no > >>> :noweb no > >>> :results output replace > >>> :session none > >>> :tangle no > >>> > >>> And C-c C-v C-v, shows that the import statements in the header do not > get > >>> expanded into the code block. > >>> > >>> So I am obviously doing something wrong. There appear to be no typos > or > >>> misspellings and the org file containing the coded is exactly this: > >>> > >>> * Test of prologue header > >>> > >>> :PROPERTIES: > >>> :header-args:python+: :prologue "import numpy as np; import os" > >>> :END: > >>> > >>> #+BEGIN_SRC python :results output > >>> print(np.__version__) > >>> #+END_SRC > >>> > >>> #+RESULTS: > >>> > >>> > >>> My init file has no org babel header arguments defined. > >>> > >>> I am using C-c C-v C-b or C-c C-v C-s to evaluate and I get > >>> > >>> "Code block produced no output." in the mini-buffer. > >>> > >>> > >>> If I use C-c C-c directly on the code block itself I get: > >>> > >>> Traceback (most recent call last): > >>> File "", line 1, in > >>> NameError: name 'np' is not defined > >>> > >>> Is there something else I need to do to get babel to recognize the > header-args? > >>> > >>> Thanks > >>> > >>> > >>> On 8/7/20 12:51 PM, Berry, Charles wrote: > >>>>> On Aug 7, 2020, at 8:39 AM, William McCoy wrote: > >>>>> > >>>>> 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? > >>>>> > >>>>> > >>>> It is sometimes useful to use C-c C-v C-i to see what header args org > has detected for a source block. Misspelled words sometimes wreak havoc and > invisible characters can cause real pain. > >>>> > >>>> > >>>> Also, it helps to use C-c C-v C-v to to see the expanded code block. > When I do this with Kens' ECM, I get > >>>> > >>>> import numpy as np; import os > >>>> print(np.__version__) > >>>> > >>>> in the preview buffer. > >>>> > >>>> HTH, > >>>> > >>>> Chuck > >>>> > >>>> > >>>>> 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? > >> > >> -- > >> Thomas S. Dye > >> https://tsdye.online/tsdye > > > > > --000000000000523a7605ac55fa00 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Is there a straightforward way to have a multiline prologu= e? Or maybe use the body of named block as prologue?

On Fri, Aug 7, 2020 at = 5:02 PM William McCoy <wdm8588@gmail.com> wrote:
Yes, of co= urse, that was it!=C2=A0 I ran into that issue a few months ago and
then I forgot about again!

Thanks both for your help!

Bill

On 8/7/20 5:25 PM, Berry, Charles wrote:
> Good catch. Also it works if you put the property block at the very be= ginning of the file.
>
> This sometimes helps:
>
> M-x org-lint RET
>
> which in this case reports "Incorrect contents for PROPERTIES dra= wer"
>
> which is a bit cryptic IMO, but does point to any issue with the prope= rty.
>
> HTH,
>
> Chuck
>
>> On Aug 7, 2020, at 2:18 PM, Thomas S. Dye <tsd@tsdye.online>= wrote:
>>
>> It works here if you remove the blank line between the headline an= d the PROPERTIES block.
>>
>> William McCoy writes:
>>
>>> Chuck,
>>>
>>> Thanks very much for your response.=C2=A0 I didn't know ab= out those options.=C2=A0 When I
>>> use C-c C-v C-i, I get the following:
>>>
>>> Lang: python
>>> Properties:
>>>=C2=A0 =C2=A0 =C2=A0:header-args=C2=A0 =C2=A0 nil
>>>=C2=A0 =C2=A0 =C2=A0:header-args:python=C2=A0 =C2=A0 =C2=A0nil<= br> >>> Header Arguments:
>>>=C2=A0 =C2=A0 =C2=A0:cache=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 no=
>>>=C2=A0 =C2=A0 =C2=A0:exports=C2=A0 =C2=A0 =C2=A0 =C2=A0 code >>>=C2=A0 =C2=A0 =C2=A0:hlines=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0no=
>>>=C2=A0 =C2=A0 =C2=A0:noweb=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 no=
>>>=C2=A0 =C2=A0 =C2=A0:results=C2=A0 =C2=A0 =C2=A0 =C2=A0 output = replace
>>>=C2=A0 =C2=A0 =C2=A0:session=C2=A0 =C2=A0 =C2=A0 =C2=A0 none >>>=C2=A0 =C2=A0 =C2=A0:tangle=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0no=
>>>
>>> And C-c C-v C-v, shows that the import statements in the heade= r do not get
>>> expanded into the code block.
>>>
>>> So I am obviously doing something wrong.=C2=A0 There appear to= be no typos or
>>> misspellings and the org file containing the coded is exactly = this:
>>>
>>> * Test of prologue header
>>>
>>> :PROPERTIES:
>>> :header-args:python+: :prologue "import numpy as np; impo= rt os"
>>> :END:
>>>
>>> #+BEGIN_SRC python :results output
>>> print(np.__version__)
>>> #+END_SRC
>>>
>>> #+RESULTS:
>>>
>>>
>>> My init file has no org babel header arguments defined.
>>>
>>> I am using C-c C-v C-b or C-c C-v C-s to evaluate and I get >>>
>>> "Code block produced no output." in the mini-buffer.=
>>>
>>>
>>> If I use C-c C-c directly on the code block itself I get:
>>>
>>> Traceback (most recent call last):
>>>=C2=A0 =C2=A0File "<stdin>", line 1, in <mod= ule>
>>> NameError: name 'np' is not defined
>>>
>>> Is there something else I need to do to get babel to recognize= the header-args?
>>>
>>> Thanks
>>>
>>>
>>> On 8/7/20 12:51 PM, Berry, Charles wrote:
>>>>> On Aug 7, 2020, at 8:39 AM, William McCoy <wdm8588@gmail.com> w= rote:
>>>>>
>>>>> This use of :prologue appeared to me to be very useful= .=C2=A0 But for some reason when I try it out it does not work for me.=C2= =A0 I just get a message that the code block produced no output and that &#= 39;np' is not defined.=C2=A0 Just to check, when I put the import state= ments directly within my code block it works fine.
>>>>>
>>>>> I am running:=C2=A0 Org mode version 9.3.7 (9.3.7-16-g= 521d7f-elpa
>>>>>
>>>>> Any idea what I'm doing wrong?
>>>>>
>>>>>
>>>> It is sometimes useful to use C-c C-v C-i to see what head= er args org has detected for a source block. Misspelled words sometimes wre= ak havoc and invisible characters can cause real pain.
>>>>
>>>>
>>>> Also, it helps to use C-c C-v C-v to to see the expanded c= ode block. When I do this with Kens' ECM, I get
>>>>
>>>> import numpy as np; import os
>>>> print(np.__version__)
>>>>
>>>> in the preview buffer.
>>>>
>>>> HTH,
>>>>
>>>> Chuck
>>>>
>>>>
>>>>> 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&g= t; wrote:
>>>>>> What about using :pre or :prologue and setting it = at the header or document level?
>>>>>>
>>>>>> Please excuse brevity. Sent from tiny pocket compu= ter with non-haptic-feedback keyboard.
>>>>>>
>>>>>> On Wed, Aug 5, 2020, 14:22 George Mauer <gmauer@gmail.com> wr= ote:
>>>>>> 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 b= lock and then automatically have access to it in other src blocks further d= own the document. I don't really want a stateful session (nor does ob-r= acket support sessions) so I essentially want the equivalent of automatical= ly 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 i= deas for how to extend things so it is?
>>
>> --
>> Thomas S. Dye
>> https://tsdye.online/tsdye
>


--000000000000523a7605ac55fa00--