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 nA+GFnvPLV+zBgAA0tVLHw (envelope-from ) for ; Fri, 07 Aug 2020 22:02:35 +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 cPHDEXvPLV/QYQAAB5/wlQ (envelope-from ) for ; Fri, 07 Aug 2020 22:02:35 +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 842D39409DF for ; Fri, 7 Aug 2020 22:02:34 +0000 (UTC) Received: from localhost ([::1]:36466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k4ARb-00040N-TH for larch@yhetil.org; Fri, 07 Aug 2020 18:02:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k4ARC-000404-5u for emacs-orgmode@gnu.org; Fri, 07 Aug 2020 18:02:06 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:37775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k4ARA-0005j2-Bq for emacs-orgmode@gnu.org; Fri, 07 Aug 2020 18:02:05 -0400 Received: by mail-qv1-xf41.google.com with SMTP id y11so1468190qvl.4 for ; Fri, 07 Aug 2020 15:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=wpiw85yCe7lGk4FN1pCfMhPRWxfTznRcfEXXfF6MRQM=; b=f+gjJBvMgRDLIo2G1+yJJ5e627WIGrQId9x6t+Up02ltOoMLYuAMJJAZ3bfibsfsfE /XgNqvFG3VuzAu09CDcIfCwK6HlYG1BnULRSlPM7P+F65kr8gD2vCGSdF22SN+T+2xdX TTTx93qwW7Wx8rPJ9cw+649/f1MW2rucs5Y1vyC1tr2rV2HK65fXBI5/4exLR2amZPNL f8fcFTsDtmz3lBb0OHdD7utP+QzKBv4lluqmxC94EpyM1yGwsKzumP0rGcKK4/cx7wwO zj/sC2sWcSZHxNEsuCpVDCW0Z7C7jlxr/woHF8g6WUXY4/ePpKz4iPLsaagskKGg1wyh 9aKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=wpiw85yCe7lGk4FN1pCfMhPRWxfTznRcfEXXfF6MRQM=; b=husxfGfkbd0URogfPdsWaeRhvA+onFr5kQ2xC34WGRetlSPCzY1XpdqEhvlH2TEa+6 pyOrfvTrEHR+yEit6nchLQsRl1Oj83dwVGPPtDPJStnq1X11w8ZbrydkALXRCSCQslAy MpRjYOrBmIJXwNvDFvMfSTsqR9DVAQftqAkwew9oOzNU5hQrC6itrp0jezOfEvqgB8se sVOlAaN0FG9fk6NCE0KP3yy45MWDBzSxeAPi3aLPD9Xhh59T35DkyZh+FsW15vZ4SRtP cFDKOyAlJ7W7aCi7mpoVIcyVFGDlPbelns3OdasOr+FJwHRPm00r3QXE/eKo3++qJBa4 SxaQ== X-Gm-Message-State: AOAM531tUWHFp7Xz16+Zq8AoCr6dklkTgIZffG2M36rJA930OMtn4EMx sW2JL2Bv1PRDFrMrQGDfX0oLpBFwYoU= X-Google-Smtp-Source: ABdhPJz2Oc+GdJiDcNP9aR2mHVrf5asmSCAAPGntacIFhsyzFSgrADp64wbsHMzx8o5Jccfz7PaDdw== X-Received: by 2002:a05:6214:1503:: with SMTP id e3mr17305079qvy.104.1596837721469; Fri, 07 Aug 2020 15:02:01 -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 n128sm2597312qke.8.2020.08.07.15.02.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Aug 2020 15:02:00 -0700 (PDT) Subject: Re: Can you automatically noweb include? To: "Berry, Charles" , "Thomas S. Dye" References: <3D721ED9-B51F-47D2-B2D4-7017FCA5F95C@health.ucsd.edu> <87k0yanohq.fsf@tsdye.online> <943BE6FC-05D6-4AFD-9A97-512B626822E2@health.ucsd.edu> From: William McCoy Message-ID: Date: Fri, 7 Aug 2020 18:01:59 -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: <943BE6FC-05D6-4AFD-9A97-512B626822E2@health.ucsd.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::f41; envelope-from=wdm8588@gmail.com; helo=mail-qv1-xf41.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, 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: , Cc: org-mode mailing list 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=f+gjJBvM; 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: YRUt3I1STI+4 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 >