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 sLpyEylHVGD3GgAA0tVLHw (envelope-from ) for ; Fri, 19 Mar 2021 06:39:37 +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 yMA1DylHVGA+ZwAAbx9fmQ (envelope-from ) for ; Fri, 19 Mar 2021 06:39:37 +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 B295F26D98 for ; Fri, 19 Mar 2021 07:39:36 +0100 (CET) Received: from localhost ([::1]:44736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN8nH-0003IW-US for larch@yhetil.org; Fri, 19 Mar 2021 02:39:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN8mb-0003IK-HU for emacs-orgmode@gnu.org; Fri, 19 Mar 2021 02:38:53 -0400 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]:60181) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN8mZ-0001gF-9k for emacs-orgmode@gnu.org; Fri, 19 Mar 2021 02:38:53 -0400 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.94) for emacs-orgmode@gnu.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1lN8mW-000zZs-59; Fri, 19 Mar 2021 07:38:48 +0100 Received: from 130-133-144-203.mna.fu-berlin.de ([130.133.144.203] helo=hornfels) by inpost2.zedat.fu-berlin.de (Exim 4.94) for emacs-orgmode@gnu.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1lN8mV-004BX7-TP; Fri, 19 Mar 2021 07:38:48 +0100 From: Loris Bennett To: Org Mode Mailing List Subject: Re: Sharing variables between source blocks without session References: <87o8fjscia.fsf@hornfels.zedat.fu-berlin.de> <87r1kf6xdq.fsf@ucl.ac.uk> <87im5owqa3.fsf@hornfels.zedat.fu-berlin.de> Date: Fri, 19 Mar 2021 07:38:47 +0100 In-Reply-To: (Malcolm Cook's message of "Thu, 18 Mar 2021 17:59:48 +0000") Message-ID: <87h7l7ps08.fsf@hornfels.zedat.fu-berlin.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Original-Sender: loris.bennett@fu-berlin.de X-Originating-IP: 130.133.144.203 Received-SPF: pass client-ip=130.133.4.66; envelope-from=loris@zedat.fu-berlin.de; helo=outpost1.zedat.fu-berlin.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616135976; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=RPaYktzk5X6P6ldHfz4VlKaAMXjgwaWmdrOLjnl63Ko=; b=RVhuPafEBczft0uK94P48sj4sOM15xIVME752/uijrForHIiaEXwlGTsHwx6SD8U1ox6ln hd10vzd8L7g5r/USCfvhVgEpCe3vFhhfWA5AxPw5tUJ8AEiSOBVPcP+3BPoKLAcgFM14Gy c2uggy2JAZYZR4kK2bRrnBW/2BmwbasqDxo05CG2JiouwST2oDfUE6zUFcPxx8F5kil4MW /4Pndo1QRozOuAE/vBjL0Yoep5C3IN64ZmL4cQSHRs1KGJ7V66Twr9n9f4rtAD19qhSafZ hKjIhh9BfmrQb7VU/hjx1wpMdanjuMSRm24FOlMr8R9EwUOPhbbFqpmrvCHnRg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616135976; a=rsa-sha256; cv=none; b=CbrgzUliVDrt+PZmF+NgxE2tEJIlRPJ5fI+5QpqHP+lw78smDzDbfyMicYOuo40TNVAD28 +hMrOQV099kTHRftRTFUlUWdlohUL0LwtuGzysep2+FLNramLHd93xx620TCC6Na4TdKY4 XLoVxqitAzDBvg0ccRgZIIkQJGJ3HwuXEn/I/IiOAEmvV8N1adONnfRaxGdbFZP9N2naJe VGoacfxUMjO9XaSJsd+gGWqKcj7EQ7ZxtXVcnK32oEiPGVkms89bRiJvpAdqcrifU53n5E +QWP4U22Cc9Bl+WG1aQfh07j9T36o4OeFYGxE9gXRJ/PvHhBTvM6t3LmEzaU2A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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-Migadu-Spam-Score: -2.41 Authentication-Results: aspmx1.migadu.com; dkim=none; 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-Migadu-Queue-Id: B295F26D98 X-Spam-Score: -2.41 X-Migadu-Scanner: scn0.migadu.com X-TUID: oVo0+0veemUn "Cook, Malcolm" writes: > Eric S Fraga writes: >> >>> On Tuesday, 16 Mar 2021 at 09:56, Loris Bennett wrote: >>>> How can I avoid having to declare the variable 'user' for both blocks? >>> >>> I imagine you could use a property, as in >>> >>> #+property: header-args :var user=loris >>> >>> or even make it specific for the particular language. >>> >>> (untested) >> >>Thanks for point out using 'header-args;' as property. However, if I do >>the following, the variable is unset in the shell script: >> >>#+properties: header-args :var user=loris >> >>#+begin_src sh >>echo user: ${user} >>#+end_src >> >>#+RESULTS: >>: user: >> >>Is that supposed to work, or am I doing something wrong? > > I am unfamiliar with using the plural form of property, as you are trying, at buffer-level nor do I see documented possible here: > https://orgmode.org/manual/Property-Syntax.html#Property-Syntax > > try this: > > #+property: header-args:sh :var user="loris" > #+begin_src sh > > echo user: ${user} > #+end_src > > Important: After adding or modifying the #+property line, you will need to instruct org to "refresh your local setup" which I typically accomplish by positioning the point on that line and typing C-c C-c This doesn't work for me - there is no error, but I get the same result as above, i.e. the variable ${users} is not set. Does it work for you? What does work for me is using a section property rather than a buffer property: * Dummy Section :PROPERTIES: :header-args: :R :var user="loris" :END: #+begin_src sh echo user: ${user} #+end_src #+RESULTS: : user: loris However, the restriction to source blocks of a particular language does not seem to work like this, but maybe I have got the syntax wrong (again). > >> >>Cheers, >> >>Loris >> >>-- >>This signature is currently under construction. >>