From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id Q5YkNQhNVGDYQAAA0tVLHw (envelope-from ) for ; Fri, 19 Mar 2021 07:04:40 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id uMJ3MAhNVGBxeQAAbx9fmQ (envelope-from ) for ; Fri, 19 Mar 2021 07:04:40 +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 aspmx2.migadu.com (Postfix) with ESMTPS id 231D4165B9 for ; Fri, 19 Mar 2021 08:04:40 +0100 (CET) Received: from localhost ([::1]:39742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN9BX-00065G-4r for larch@yhetil.org; Fri, 19 Mar 2021 03:04:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN9B8-00063d-O9 for emacs-orgmode@gnu.org; Fri, 19 Mar 2021 03:04:14 -0400 Received: from ciao.gmane.io ([116.202.254.214]:51758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN9B6-0000JC-Cz for emacs-orgmode@gnu.org; Fri, 19 Mar 2021 03:04:14 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lN9B3-0008vs-Qm for emacs-orgmode@gnu.org; Fri, 19 Mar 2021 08:04:09 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: "Loris Bennett" Subject: Re: Sharing variables between source blocks without session Date: Fri, 19 Mar 2021 08:04:05 +0100 Message-ID: <871rcbpqu2.fsf@hornfels.zedat.fu-berlin.de> References: <87o8fjscia.fsf@hornfels.zedat.fu-berlin.de> <87r1kf6xdq.fsf@ucl.ac.uk> <87im5owqa3.fsf@hornfels.zedat.fu-berlin.de> <87h7l7ps08.fsf@hornfels.zedat.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cancel-Lock: sha1:0lQhz2GNjSHYj7Bb0Iy04dmC5ts= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-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: , 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=1616137480; 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:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=uXQSqJsyPrfqxutteawu1ZkUHT0Z2DcgOwl+N11fZJI=; b=tLziGHpXsv5c54mdMLFd3Qi9A5YIK681kwCGCwXjg540AoFjSz91KitaobKO9RWLm/eKhO DYPAP6HIGhb29bEVeKnc5QfPAPPXTJkRsHSzRoG9VbDXF/yQjCNX12NkYjk8hleqfcaZkP bDZonLQHNR6yzZTyzzlmxWDxTHB0tmMZTBwYERlPaqVC6yauI2PMusmeFbJu9wbZga7PwF V0qiha3YgUkyFXJ2tFNuNu/fpO1lukr+EOJIiAuWJ0MGgqNF8HvsWdA0VSw0bS96x4SGwW 7y3x2CrSfHNYF9u8c+OCJH7jqU4p3p7DKvK1Y4WElYVTacNFA9l9AXKSdxa+9A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616137480; a=rsa-sha256; cv=none; b=BLx1QMfd46hh/FZ9rC4eKlNCbAjl7d6sXC0VZLU/iV86Mjsvp9fy1B7EVzyGKhpKQfbQ24 SAdrm9h6BBqAkDhh+K0q1J/jQrsgUl9/d1U9p6OYbgNVakAA1cKeuATMB+aWYkpcGlq906 j6/l+boZbcx9J6XeafIvUMwRRD+FjkefIlhALELIHVUqDfhSt9wrXZxyQ5WK917PpEOC1L hloTmbrnkLKWUzAT7MBWwahbaAOgve1D8jtZbhyxGO7d25VaCbOfD5MMYY3U027RELXxo0 kdBKDZbVgHtU67Lx2AUlraMZ40eAYqdYXjnFjw5Czt3Pj0MMRNIdT/EcBjry1Q== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx2.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: -1.91 Authentication-Results: aspmx2.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx2.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: 231D4165B9 X-Spam-Score: -1.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: XHkfBw6o11XL Loris Bennett writes: > "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? Sorry, this does work for me. > 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). Quotes around string variables is the important thing. >> >>> >>>Cheers, >>> >>>Loris >>> >>>-- >>>This signature is currently under construction. >>> > > -- This signature is currently under construction.