Hello all, TL;DR: I have the need to reference a table that is in another file to pass as data to a src block in the current file. Is this possible? Hints welcome! Longer version: I am running a series of numerical experiments, each of which generates output files (using org syntax!). I want to process the data in those files for inclusion in a paper. Now, I could write a shell script which extracts all these data and collates them etc. but it would be ideal if I could simply refer to a table in another file directly. The tables are all named although a given table in each output file will have the same name (I hope that makes sense). One thing that comes to mind is some elisp in the argument to the :var header argument. Is this possible? I've not tried... Thank you, eric -- : Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-381-g17ef1b.dirty
[-- Attachment #1: Type: text/plain, Size: 1329 bytes --] This syntax works for me. #+BEGIN_SRC python :var data=data.org:remote-table print(data) #+END_SRC John ----------------------------------- Professor John Kitchin (he/him/his) Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Thu, Apr 29, 2021 at 8:36 AM Eric S Fraga <e.fraga@ucl.ac.uk> wrote: > Hello all, > > TL;DR: I have the need to reference a table that is in another file to > pass as data to a src block in the current file. Is this possible? > Hints welcome! > > Longer version: I am running a series of numerical experiments, each of > which generates output files (using org syntax!). I want to process the > data in those files for inclusion in a paper. Now, I could write a > shell script which extracts all these data and collates them etc. but it > would be ideal if I could simply refer to a table in another file > directly. The tables are all named although a given table in each > output file will have the same name (I hope that makes sense). > > One thing that comes to mind is some elisp in the argument to the :var > header argument. Is this possible? I've not tried... > > Thank you, > eric > > -- > : Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-381-g17ef1b.dirty > > [-- Attachment #2: Type: text/html, Size: 2040 bytes --]
On Thursday, 29 Apr 2021 at 09:17, John Kitchin wrote:
> This syntax works for me.
>
> #+BEGIN_SRC python :var data=data.org:remote-table
Brilliant! As usual, if I want to do something in org, it can be done.
Did you find this in the manual? I did look but must have missed it.
thank you,
eric
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-381-g17ef1b.dirty
And, just to add: it works like a charm! Thank you again. -- : Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-381-g17ef1b.dirty
[-- Attachment #1: Type: text/plain, Size: 846 bytes --] I don't know if it is in the manual. It would be great to have it in https://orgmode.org/manual/Environment-of-a-Code-Block.html. John ----------------------------------- Professor John Kitchin (he/him/his) Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Thu, Apr 29, 2021 at 9:42 AM Eric S Fraga <e.fraga@ucl.ac.uk> wrote: > On Thursday, 29 Apr 2021 at 09:17, John Kitchin wrote: > > This syntax works for me. > > > > #+BEGIN_SRC python :var data=data.org:remote-table > > Brilliant! As usual, if I want to do something in org, it can be done. > > Did you find this in the manual? I did look but must have missed it. > > thank you, > eric > > -- > : Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-381-g17ef1b.dirty > [-- Attachment #2: Type: text/html, Size: 1546 bytes --]
On Thursday, 29 Apr 2021 at 10:51, John Kitchin wrote:
> I don't know if it is in the manual. It would be great to have it in
> https://orgmode.org/manual/Environment-of-a-Code-Block.html.
Indeed. I'll add this to my todo list. (although happy if anybody else
steps up and does it, of course)
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-381-g17ef1b.dirty
Hello,
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> Hello all,
>
> TL;DR: I have the need to reference a table that is in another file to
> pass as data to a src block in the current file. Is this possible?
> Hints welcome!
I smell something strange going on here ;). For every Org related
question I had in the last few weeks I found at least one other person
that had the same question roughly at the same time.
I use Org to generate projects, import stuff, set permissions etc. on
several servers for a software engineering course. I think it would be
nice to separate the student's personal data in Org tables from the Org
code that get checked into a repository.
My first attempt was :var data=data.org::remote-table, but the familiar
double colon didn't work, the single colon indeed did the trick.
Regards
hmw
On Saturday, 1 May 2021 at 07:58, Michael Welle wrote:
> I smell something strange going on here ;).
Synchronicity, aka great minds think alike. :-)
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-405-g0a689b
[-- Attachment #1: Type: text/plain, Size: 301 bytes --] On Thursday, 29 Apr 2021 at 10:51, John Kitchin wrote: > I don't know if it is in the manual. It would be great to have it in > https://orgmode.org/manual/Environment-of-a-Code-Block.html. Attached is a patch for this. Thank you. -- : Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-393-gd44bd5 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org-manual.org-describe-external-reference-for-var-h.patch --] [-- Type: text/x-diff, Size: 1191 bytes --] From 339e44b08b73ed083c15311d230db5f4d98abc8a Mon Sep 17 00:00:00 2001 From: Eric S Fraga <e.fraga@ucl.ac.uk> Date: Mon, 3 May 2021 13:37:58 +0100 Subject: [PATCH] org-manual.org: describe external reference for :var header * org-manual.org: the description of the :var header argument for working with source code has been expanded to mention the possibility of having an external reference, a reference to an element in another file. --- doc/org-manual.org | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 42a12e9d4..3008d5a48 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -16797,7 +16797,11 @@ the =var= header argument. body. {{{var(ASSIGN)}}} is a literal value, such as a string, a number, a reference to a table, a list, a literal example, another code block---with or without arguments---or the results of evaluating -a code block. +a code block. {{{var(ASSIGN)}}} may specify a filename for references +to elements in a different file, using a =:= to separate the filename +from the reference. + +: :var NAME=FILE:REFERENCE Here are examples of passing values by reference: -- 2.29.2
Hi Eric,
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> On Thursday, 29 Apr 2021 at 10:51, John Kitchin wrote:
>> I don't know if it is in the manual. It would be great to have it in
>> https://orgmode.org/manual/Environment-of-a-Code-Block.html.
>
> Attached is a patch for this. Thank you.
Applied with commit 479a3da22 in master, thanks.
--
Bastien
On Monday, 3 May 2021 at 15:00, Bastien wrote:
> Applied with commit 479a3da22 in master, thanks.
Thank you Bastien. However, as soon as I looked, I realised that my
commit message missed out the "doc/" part of the file name for the
manual. Can you fix that (if necessary)?
Thanks again,
eric
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-478-ge80be0
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> On Monday, 3 May 2021 at 15:00, Bastien wrote:
>> Applied with commit 479a3da22 in master, thanks.
>
> Thank you Bastien. However, as soon as I looked, I realised that my
> commit message missed out the "doc/" part of the file name for the
> manual. Can you fix that (if necessary)?
Such small mistakes are okay, don't worry. It's better to leave them
than to edit commit messages that have already been pushed to the public.
--
Bastien
On Monday, 3 May 2021 at 15:43, Bastien wrote:
> Such small mistakes are okay, don't worry. It's better to leave them
> than to edit commit messages that have already been pushed to the
> public.
Okay, thank you. I'll try to be more careful next time!
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-393-gd44bd5