emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* could a :var header argument refer to a data table in another file?
@ 2021-04-29 12:22 Eric S Fraga
  2021-04-29 13:17 ` John Kitchin
  2021-05-01  5:58 ` Michael Welle
  0 siblings, 2 replies; 13+ messages in thread
From: Eric S Fraga @ 2021-04-29 12:22 UTC (permalink / raw)
  To: Emacs Org mode mailing list

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: could a :var header argument refer to a data table in another file?
  2021-04-29 12:22 could a :var header argument refer to a data table in another file? Eric S Fraga
@ 2021-04-29 13:17 ` John Kitchin
  2021-04-29 13:42   ` Eric S Fraga
  2021-04-29 14:02   ` could a :var header argument refer to a data table in another file? Eric S Fraga
  2021-05-01  5:58 ` Michael Welle
  1 sibling, 2 replies; 13+ messages in thread
From: John Kitchin @ 2021-04-29 13:17 UTC (permalink / raw)
  To: Emacs Org mode mailing list

[-- 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 --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: could a :var header argument refer to a data table in another file?
  2021-04-29 13:17 ` John Kitchin
@ 2021-04-29 13:42   ` Eric S Fraga
  2021-04-29 14:51     ` John Kitchin
  2021-04-29 14:02   ` could a :var header argument refer to a data table in another file? Eric S Fraga
  1 sibling, 1 reply; 13+ messages in thread
From: Eric S Fraga @ 2021-04-29 13:42 UTC (permalink / raw)
  To: John Kitchin; +Cc: Emacs Org mode mailing list

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: could a :var header argument refer to a data table in another file?
  2021-04-29 13:17 ` John Kitchin
  2021-04-29 13:42   ` Eric S Fraga
@ 2021-04-29 14:02   ` Eric S Fraga
  1 sibling, 0 replies; 13+ messages in thread
From: Eric S Fraga @ 2021-04-29 14:02 UTC (permalink / raw)
  To: John Kitchin; +Cc: Emacs Org mode mailing list

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: could a :var header argument refer to a data table in another file?
  2021-04-29 13:42   ` Eric S Fraga
@ 2021-04-29 14:51     ` John Kitchin
  2021-04-29 15:36       ` Eric S Fraga
  2021-05-03 12:43       ` [patch] documentation update (was Re: could a :var header argument refer to a data table in another file?) Eric S Fraga
  0 siblings, 2 replies; 13+ messages in thread
From: John Kitchin @ 2021-04-29 14:51 UTC (permalink / raw)
  To: John Kitchin, Emacs Org mode mailing list

[-- 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 --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: could a :var header argument refer to a data table in another file?
  2021-04-29 14:51     ` John Kitchin
@ 2021-04-29 15:36       ` Eric S Fraga
  2021-05-03 12:43       ` [patch] documentation update (was Re: could a :var header argument refer to a data table in another file?) Eric S Fraga
  1 sibling, 0 replies; 13+ messages in thread
From: Eric S Fraga @ 2021-04-29 15:36 UTC (permalink / raw)
  To: John Kitchin; +Cc: Emacs Org mode mailing list

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: could a :var header argument refer to a data table in another file?
  2021-04-29 12:22 could a :var header argument refer to a data table in another file? Eric S Fraga
  2021-04-29 13:17 ` John Kitchin
@ 2021-05-01  5:58 ` Michael Welle
  2021-05-01  8:42   ` Eric S Fraga
  1 sibling, 1 reply; 13+ messages in thread
From: Michael Welle @ 2021-05-01  5:58 UTC (permalink / raw)
  To: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: could a :var header argument refer to a data table in another file?
  2021-05-01  5:58 ` Michael Welle
@ 2021-05-01  8:42   ` Eric S Fraga
  0 siblings, 0 replies; 13+ messages in thread
From: Eric S Fraga @ 2021-05-01  8:42 UTC (permalink / raw)
  To: Michael Welle; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [patch] documentation update (was Re: could a :var header argument refer to a data table in another file?)
  2021-04-29 14:51     ` John Kitchin
  2021-04-29 15:36       ` Eric S Fraga
@ 2021-05-03 12:43       ` Eric S Fraga
  2021-05-03 13:00         ` Bastien
  1 sibling, 1 reply; 13+ messages in thread
From: Eric S Fraga @ 2021-05-03 12:43 UTC (permalink / raw)
  To: Emacs Org mode mailing list

[-- 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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [patch] documentation update (was Re: could a :var header argument refer to a data table in another file?)
  2021-05-03 12:43       ` [patch] documentation update (was Re: could a :var header argument refer to a data table in another file?) Eric S Fraga
@ 2021-05-03 13:00         ` Bastien
  2021-05-03 13:35           ` Eric S Fraga
  0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2021-05-03 13:00 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Emacs Org mode mailing list

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch] documentation update (was Re: could a :var header argument refer to a data table in another file?)
  2021-05-03 13:00         ` Bastien
@ 2021-05-03 13:35           ` Eric S Fraga
  2021-05-03 13:43             ` Bastien
  0 siblings, 1 reply; 13+ messages in thread
From: Eric S Fraga @ 2021-05-03 13:35 UTC (permalink / raw)
  To: Bastien; +Cc: Emacs Org mode mailing list

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch] documentation update (was Re: could a :var header argument refer to a data table in another file?)
  2021-05-03 13:35           ` Eric S Fraga
@ 2021-05-03 13:43             ` Bastien
  2021-05-03 13:47               ` Eric S Fraga
  0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2021-05-03 13:43 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Emacs Org mode mailing list

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [patch] documentation update (was Re: could a :var header argument refer to a data table in another file?)
  2021-05-03 13:43             ` Bastien
@ 2021-05-03 13:47               ` Eric S Fraga
  0 siblings, 0 replies; 13+ messages in thread
From: Eric S Fraga @ 2021-05-03 13:47 UTC (permalink / raw)
  To: Bastien; +Cc: Emacs Org mode mailing list

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-05-03 13:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 12:22 could a :var header argument refer to a data table in another file? Eric S Fraga
2021-04-29 13:17 ` John Kitchin
2021-04-29 13:42   ` Eric S Fraga
2021-04-29 14:51     ` John Kitchin
2021-04-29 15:36       ` Eric S Fraga
2021-05-03 12:43       ` [patch] documentation update (was Re: could a :var header argument refer to a data table in another file?) Eric S Fraga
2021-05-03 13:00         ` Bastien
2021-05-03 13:35           ` Eric S Fraga
2021-05-03 13:43             ` Bastien
2021-05-03 13:47               ` Eric S Fraga
2021-04-29 14:02   ` could a :var header argument refer to a data table in another file? Eric S Fraga
2021-05-01  5:58 ` Michael Welle
2021-05-01  8:42   ` Eric S Fraga

Code repositories for project(s) associated with this public 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).