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 CKwrIHouLl9JUgAA0tVLHw (envelope-from ) for ; Sat, 08 Aug 2020 04:47:54 +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 CGERHHouLl/fAwAAB5/wlQ (envelope-from ) for ; Sat, 08 Aug 2020 04:47:54 +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 C090B9403A9 for ; Sat, 8 Aug 2020 04:47:53 +0000 (UTC) Received: from localhost ([::1]:50704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k4Glr-0002gf-4I for larch@yhetil.org; Sat, 08 Aug 2020 00:47:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k4GlT-0002gT-H9 for emacs-orgmode@gnu.org; Sat, 08 Aug 2020 00:47:27 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:42803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k4GlR-0000IG-Ha for emacs-orgmode@gnu.org; Sat, 08 Aug 2020 00:47:27 -0400 Received: by mail-wr1-x429.google.com with SMTP id r4so3377261wrx.9 for ; Fri, 07 Aug 2020 21:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NfMu8ODZvbThaRpRpyreFE3r1aoj7cNyCNUWETjudAA=; b=H8RdaWY4YXzpDcfPkZaBBoFDRcpHblTTFsdChHyc6o1wt6SmgSmChJoVVuCFrTMvjp QGfmox9oAi3fbql3j8Rw633203R1ykzeykTgiZOVY1iY6hW4TNbUHSvwv/uY4qMWPT7y VFvyu+jUDmOod9yyqZ3rlRzrYkfMEImjgaCy5dUQUAP8imKOMh+Z9l2rI3RVvb7J36tD LQeLiniiHfFH/Y7kAZR1tj/6W7+InA8mN9tYkPe4FAM710nvB2l+w+1yI0MNobjMUacs gchBJTHlnoaYDJFJmgeb/zlkD91pXTHXdxGznY2p9TDag9hMvlwlwntYnmeDjLZw5COk L87Q== 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:from:date :message-id:subject:to:cc; bh=NfMu8ODZvbThaRpRpyreFE3r1aoj7cNyCNUWETjudAA=; b=BbmexHh6jSAWzv8NcFxTy1S6UMOIBTtGyG94n1DtsTGmLM7nNWsPGz+IW9p/S7RK50 O43icSqPXvU4cn6RESK1bAqAsorQ9D4NbwW0Ad6BM8HbZYLHzz7v5l2Vo3O01U2HZ4hQ sX9L5P8zz8tgz25gr/QAvfJsiJwh8vaCpjWfAd1H888CzKyX2451zIAaEKPB1T8kPUnX U5+cJUND7qPlbUIVRz1ab/ihIYKSy+15ueEtn9DU0w1hRWnopE+2DTAzAYV+t+34B2AY O56stpKRDl4DDRrkGXsGwVpuRWAMK42BXuirAsSbK5jSJnZzXPmivLm9y3ihRjJiO5Jq JdWg== X-Gm-Message-State: AOAM531+D7v39BGENUcPDfEf0A3AEsKToHNNraYkoJCEPNTudSHfJiIT LHjmUmZ5zCHHLSfgmHU/JU/PuKqxmB/y7YBEcfw= X-Google-Smtp-Source: ABdhPJxVEww11ju0Ln9NxpTTAJw66f7KyWwb16gw+ZSe9s6BrF3ktL2exR0vfpnovsYW+Qt6SZ/PkQbvl42DGyDSMDs= X-Received: by 2002:a5d:4610:: with SMTP id t16mr15606304wrq.101.1596862043563; Fri, 07 Aug 2020 21:47:23 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Tom Gillespie Date: Fri, 7 Aug 2020 21:47:12 -0700 Message-ID: Subject: Re: Can you automatically noweb include? To: gmauer@gmail.com Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=tgbugs@gmail.com; helo=mail-wr1-x429.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham 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: emacs-orgmode 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=H8RdaWY4; 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.79 X-TUID: OcPC/KYpFhh5 After a bit of investigation, it seems that wallyqs implementation of ob-racket does not treat/manage :prologue arguments correctly, which is worrying because I would assume that the semantics for how prologue works should not be something that could be accidentally broken by ob-* implementations (but that is a separate issue). More relevant to this thread is that python the prologue works as others have reported, but if you include a noweb reference in the prologue it does not get expanded. It is quite possible that this should be considered a bug since it means that prologues are added only after the main block is expanded. This seems incorrect, and I suspect that it is another bug related to the one fixed in df5a83637518ad9aa586d49884a6271f11afc592 (discussion here https://orgmode.org/list/CA+G3_PNi3uMvBiWgBdKuC3C6VJt1T1j-RKH43LRqYbr+4NS8ZA@mail.gmail.com/). The fact that prologue is not expanded means that you can modify what code is run by putting it in a prologue and org mode will be none-the wiser. The sha1 changes if you set :cache yes, which means that something in the execution code is doing something different than in the block hashing code. Further investigation required. * Use the code :PROPERTIES: :header-args:python: :prologue "<>" :END: #+name: python-helper #+begin_src python asdf = lambda : 'result' #+end_src #+begin_src python :noweb yes return asdf() #+end_src On Fri, Aug 7, 2020 at 9:20 PM Tom Gillespie wrote: > > Hah, this is what I get for not reading carefully enough. I wonder if > it is possible to stick <> in the prologue and have it > expand. > > On Fri, Aug 7, 2020 at 9:18 PM Tom Gillespie wrote: > > > > I don't see a direct answer to the original question in the thread, so > > here is an example of how I do it taken from > > https://raw.githubusercontent.com/SciCrunch/sparc-curation/master/docs/developer-guide.org. > > You can ctrl-f for racket-graph-helper to see the relevant blocks. A > > reduced version is below. Recall that I use > > https://github.com/wallyqs/ob-racket. I use this pattern all over the > > place in my org blocks. Best, > > Tom > > > > * Use the code > > :cache yes" > > #+begin_src racket :lang racket/base :noweb yes > > <> > > (helper-function "this should work") > > #+end_src > > > > #+RESULTS: > > : this should work hello world > > > > > > * Define the helpers > > #+name: racket-helper > > #+header: :prologue "#lang racket/base" > > #+begin_src racket :lang racket/base > > (define (helper-function arg) > > (string-append arg " hello world")) > > #+end_src