emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Roland Donat <roland.donat@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to pass named table reference in source block variable
Date: Thu, 8 Aug 2013 15:42:14 +0000 (UTC)	[thread overview]
Message-ID: <loom.20130808T173432-730@post.gmane.org> (raw)
In-Reply-To: 87ob98b4mc.fsf@gmail.com

Eric Schulte <schulte.eric <at> gmail.com> writes:

> 
> It sounds like you want to use tables like key-value stores.  I think
> adding such behavior directly to Org-mode would overly complicate the
> data structures passed between code blocks (which currently only
> consists of scalars and tables).  However, maybe the following could
> work.
> 
> 
> Attachment (key-value.org): text/x-org, 776 bytes
> 
> 
> Cheers,
> 

Thanks for the attachment. It works fine indeed!
But should it be so complicated to add this behavior to Org-mode?

I can rewrite your table as follows :

#+name: table
|   | keys | values |
|---+------+--------|
|   | foo  | 1      |
| ^ |      | foo    |
|   | bar  | 2      |
| ^ |      | bar    |

Now I can refer to bar value as $bar in org-table. 

So, my suggestion is only to mimic this feature to assign value of source 
block variable like :

#+headers: :results verbatim
#+begin_src sh :var foo=table$foo :var bar=table$bar
  cat <<EOF
  Pulling the data from the above table we find
  that foo is $foo and baz is $bar.
  EOF
#+end_src

But anyway, thanks for the solution.

Cheers.

Roland.

      reply	other threads:[~2013-08-08 15:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 21:31 How to pass named table reference in source block variable Roland Donat
2013-08-06 22:22 ` Thorsten Jolitz
2013-08-06 22:27   ` Nick Dokos
2013-08-07  8:28   ` Roland Donat
2013-08-07 15:29     ` Thomas S. Dye
2013-08-07 20:06       ` Roland Donat
2013-08-07 21:53         ` Thomas S. Dye
2013-08-08  7:55           ` Roland Donat
2013-08-08 15:10             ` Eric Schulte
2013-08-08 15:42               ` Roland Donat [this message]

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=loom.20130808T173432-730@post.gmane.org \
    --to=roland.donat@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).