From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id gAtwDpXFLV8VFAAA0tVLHw (envelope-from ) for ; Fri, 07 Aug 2020 21:20:21 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id aP0NCpXFLV8MfgAAbx9fmQ (envelope-from ) for ; Fri, 07 Aug 2020 21:20:21 +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 152AC9404D9 for ; Fri, 7 Aug 2020 21:20:19 +0000 (UTC) Received: from localhost ([::1]:51784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k49mj-00026h-4J for larch@yhetil.org; Fri, 07 Aug 2020 17:20:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k49lp-00026R-Ow for emacs-orgmode@gnu.org; Fri, 07 Aug 2020 17:19:22 -0400 Received: from gateway36.websitewelcome.com ([192.185.184.18]:49236) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k49ln-0000Jg-Hc for emacs-orgmode@gnu.org; Fri, 07 Aug 2020 17:19:21 -0400 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 75352400C7844 for ; Fri, 7 Aug 2020 15:43:00 -0500 (CDT) Received: from box2035.bluehost.com ([74.220.219.237]) by cmsmtp with SMTP id 49lVkHw2JOIGp49lWk1stO; Fri, 07 Aug 2020 16:19:04 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tsdye.online; s=default; h=Content-Type:MIME-Version:Message-ID:Date: In-reply-to:Subject:Cc:To:From:References:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6ZnJQVo8GpXjbxkub/2VLXNEPSipfcZWLqECRjwH01s=; b=NcpktqPJvuOSy6fu9n0G5PVO+ U2BU0iIcXnEo4tIccznqz2AmCdfbxV54aTu/Xtvf+lvlUpBGueD7VC7iyEp5jOQY2Df7QAwBlA+Ay 9AhL9BwzuAx+a9VJSgx5QhX7wnZIT1d0RNmNtSIKjEk9hzS6GLuZExdqjGNy5dFzhUxAIfRuLKWAc I77hW2qqruVLPm5c1OENb8rZFAeB7/nEbnWZXCiFUmocrsuknKa+Q1simfnA3pDSRN5BqkJ9NIb2b PljL/VjU69/ndQR5UqWzTqPmpvPKCJ4cZtB5uN4EloYwV/hpAZEa4lzS+wAdTm5++UyqOyxsNcV40 vA+m1pjXA==; Received: from cpe-98-155-168-227.hawaii.res.rr.com ([98.155.168.227]:60424 helo=poto-foou.tsdye.online) by box2035.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1k49lV-000hVY-Ai; Fri, 07 Aug 2020 15:19:01 -0600 References: <3D721ED9-B51F-47D2-B2D4-7017FCA5F95C@health.ucsd.edu> User-agent: mu4e 1.2.0; emacs 26.3 From: "Thomas S. Dye" To: emacs-orgmode@gnu.org Subject: Re: Can you automatically noweb include? In-reply-to: Date: Fri, 07 Aug 2020 11:18:57 -1000 Message-ID: <87k0yanohq.fsf@tsdye.online> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box2035.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tsdye.online X-BWhitelist: no X-Source-IP: 98.155.168.227 X-Source-L: No X-Exim-ID: 1k49lV-000hVY-Ai X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-98-155-168-227.hawaii.res.rr.com (poto-foou.tsdye.online) [98.155.168.227]:60424 X-Source-Auth: tsd@tsdye.online X-Email-Count: 1 X-Source-Cap: dHNkeWVvbmw7dHNkeWVvbmw7Ym94MjAzNS5ibHVlaG9zdC5jb20= X-Local-Domain: yes Received-SPF: pass client-ip=192.185.184.18; envelope-from=tsd@tsdye.online; helo=gateway36.websitewelcome.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/07 17:19:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: 8 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, FROM_SUSPICIOUS_NTLD=1, PDS_OTHER_BAD_TLD=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_BL=0.01, RCVD_IN_MSPIKE_L3=0.9, SPF_HELO_PASS=-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: "Berry, Charles" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=tsdye.online header.s=default header.b=NcpktqPJ; dmarc=none; 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.99 X-TUID: D7oOdPp4RgTk 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