From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id +Dj1ODbhKmBNJwAA0tVLHw (envelope-from ) for ; Mon, 15 Feb 2021 21:01:42 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id SISkNDbhKmA8KwAAbx9fmQ (envelope-from ) for ; Mon, 15 Feb 2021 21:01:42 +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 71B8A1C6B9 for ; Mon, 15 Feb 2021 22:01:42 +0100 (CET) Received: from localhost ([::1]:49448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBkzz-0007yw-Vr for larch@yhetil.org; Mon, 15 Feb 2021 16:01:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBkwN-0003ay-P5 for emacs-orgmode@gnu.org; Mon, 15 Feb 2021 15:57:55 -0500 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]:40944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lBkwL-0003pz-9G for emacs-orgmode@gnu.org; Mon, 15 Feb 2021 15:57:55 -0500 Received: by mail-qt1-x82c.google.com with SMTP id v10so5738588qtq.7 for ; Mon, 15 Feb 2021 12:57:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=user-agent:from:to:subject:message-id:date:mime-version; bh=Em738YhddMm5e3NRA1hT24TA/1aSTfT089iU5K77d00=; b=pmY50cnw26wc9j1tv60bg9mN2gqswPMcdf+4WojCLGMJJnOd66hsL8NSyMFdXmtvNn vZGfgBlaBkiAGfIyQ39Bww6FT4moEvrvjlMr0HQ14wBSynyFuELB1ohfIRVYQts9UApN Rfs18wMCxGYE3Fb3j6JbN5sQnPMPxGbapwtQdGSE4WdnfLAYaaBYi3IvlasuZPnwHDR1 FMOouLTRupdO1OUOIQ/evJkLFvuHHnvIh9/hMyAfWEdDPqeZpsTmXUNCv9rD0JNKBqXd wiJeMqNqbjvTn0C5LhMPinMtAV0mXKhd7uTnj8GwUpUJTsbAJOnXZHyavWme75mEWgRI PvXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:message-id:date :mime-version; bh=Em738YhddMm5e3NRA1hT24TA/1aSTfT089iU5K77d00=; b=miH48c39k/0cSQ6i0mULYnHY8nhkVdXWqcc3/zo8/CU6Q8KRfA4a5FjlfYoqhtoAGW 1iXyAWTl6rG3m3QNzVaIy3EGBCQ9Gfm9dCkRmdpQmR7vXbrVJYBPdN0gDt99xpOFOUVC bDsofljDk5QAMmCxdKUzhJ3uVZJi4Ag9OrrSXgi/FylwbkejkE8p4GDtXp3i3kZ3NVCC cfzeGdjpRVevW9bPwtjA0x5Vm0lgZYq8tGeRD3uvv78FVyi9YHbtJCl/GWdvM7qhxrq7 PSlcE5aNkxoiQkdWLYIphv7h63K+pk8OuQFcFnwQ7yGhBT6tyGIHLjMLVjkXShcd193e MtEA== X-Gm-Message-State: AOAM530nRPOZ6XB6FDXl/eWoeOSJOumNYnud366kVsIR9XbmW6lwxzt8 IEyWccNJv6Sedo2+BGEFXmVNT60LYLI= X-Google-Smtp-Source: ABdhPJxT0Bf06eiaNvo0J2t4YrbFZ9H7C80YlQcQ8wmebgwh8WfWab97TF4gWAdV+XlDMHdNgi3uhA== X-Received: by 2002:ac8:6b50:: with SMTP id x16mr9568278qts.91.1613422672072; Mon, 15 Feb 2021 12:57:52 -0800 (PST) Received: from localhost ([190.239.232.181]) by smtp.gmail.com with ESMTPSA id y66sm12945767qka.17.2021.02.15.12.57.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 12:57:51 -0800 (PST) User-agent: mu4e 1.4.14; emacs 27.1 From: Rodrigo Morales To: emacs-orgmode@gnu.org Subject: How to associate a code block to another one so that it is executed beforehand? Message-ID: <87r1lhaw7d.fsf@gmail.com> Date: Mon, 15 Feb 2021 15:54:14 -0500 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::82c; envelope-from=moralesrodrigo1100@gmail.com; helo=mail-qt1-x82c.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.06 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=pmY50cnw; 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-Migadu-Queue-Id: 71B8A1C6B9 X-Spam-Score: -2.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: lke9VpXQWC39 Is it possible to associate a code block (A) to another code block (B) so that when (A) is executed (B) is executed beforehand? I'm asking this because I have a bash code block (B) that creates a file that is then processed by a python code block (A) so before executing (A) block, the file needs to be created by (B). I managed to accomplish this only with shell code blocks by creating a function that gets a code block as an string but now that code blocks have different languages (bash and python) I can't use this same approach. Recall that ":prologue" inserts an string at the beginning of the code block (see minimal working example of this idea below.) #+NAME: create-file #+begin_src bash :results silent cat << EOF > main.txt foo bar EOF #+end_src #+HEADER: :prologue (org-babel-get-block-as-string "create-file") #+begin_src bash cat main.txt #+end_src #+RESULTS: #+begin_example foo bar #+end_example -- Rodrigo Morales. IRC: rdrg109 (freenode)