emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Cook, Malcolm" <MEC@stowers.org>
To: Loris Bennett <loris.bennett@fu-berlin.de>,
	Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: RE: Sharing variables between source blocks without session
Date: Thu, 18 Mar 2021 17:59:48 +0000	[thread overview]
Message-ID: <MW3PR20MB341781447D4C63AADA354488BE699@MW3PR20MB3417.namprd20.prod.outlook.com> (raw)
In-Reply-To: <87im5owqa3.fsf@hornfels.zedat.fu-berlin.de>

Eric S Fraga <mailto:e.fraga@ucl.ac.uk> 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

>
>Cheers,
>
>Loris
>
>-- 
>This signature is currently under construction.
>

  parent reply	other threads:[~2021-03-18 18:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16  8:56 Loris Bennett
2021-03-16  9:16 ` Loris Bennett
2021-03-16 13:28 ` Eric S Fraga
2021-03-18 13:21   ` Loris Bennett
2021-03-18 15:56     ` Eric S Fraga
2021-03-19  6:50       ` Loris Bennett
2021-03-18 17:59     ` Cook, Malcolm [this message]
2021-03-19  6:38       ` Loris Bennett
2021-03-19  7:04         ` Loris Bennett
2021-03-19 13:26         ` Eric S Fraga
2021-03-19 13:59           ` Loris Bennett
2021-03-19 14:26             ` Eric S Fraga
2021-03-22  7:39               ` Loris Bennett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MW3PR20MB341781447D4C63AADA354488BE699@MW3PR20MB3417.namprd20.prod.outlook.com \
    --to=mec@stowers.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=loris.bennett@fu-berlin.de \
    --subject='RE: Sharing variables between source blocks without session' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).