From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: Re: #+call split into multiple lines?
Date: Fri, 29 Mar 2013 10:33:56 +0800 [thread overview]
Message-ID: <87li97gciz.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 86ip4bw6yd.fsf@somewhere.org
"Sebastien Vauban"
<wxhgmqzgwmuf@spammotel.com> writes:
> Hi Thomas,
>
> Thomas S. Dye wrote:
>> In this situation I often put the arguments in a named Org table and
>> then write the Babel source code block to take a single argument--the
>> table name--and parse the information passed in that way.
>>
>> #+name: card-table
>> | cname | gname | photo | etc.|
>> | Dr. Stefan Vollmar | Stefan | stefan-vollmar.jpg | ... |
>> | Dr. Stefan Vollmar, Jr. | Stefan Jr. | stefan-vollmar-jr.jpg | ... |
>>
>>
>> #+call: mhead-hcard(card=card-table[0,]) for Stefan
>>
>> #+call: mhead-hcard(card=card-table[1,]) for Stefan Jr.
>>
>> If you don't mind writing some extra code for the Babel function, then
>>
>> #+call: mhead-hcard(card=card-table,gname="Stefan")
>>
>> etc.
>
> And do you eventually have a way to write a "for-loop" for all the lines of
> the tables, not being forced to write as many calls as the number of lines you
> do have?
>
> I don't see (immediately) how to do such, but that would really allow to
> promote such a use case!
I think Thomas means you store *all* your cards in a single table, and
pass that entire table to the mhead-hcard function every time you call
it. The function gets the whole table, and it is responsible for
choosing which card(s) to pick from the table, and what to do with them.
In Thomas' example, you could pass it an extra parameter and use that to
pick a card.
The loop you're talking about happens not outside of the #+call, but
inside the function being #+call'd.
Hope that's clear,
E
PS the (card=card-table[0,]) syntax is new to me, is that a
Babel-specific construct?
next prev parent reply other threads:[~2013-03-29 2:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-28 20:49 #+call split into multiple lines? Stefan Vollmar
2013-03-28 21:17 ` Thomas S. Dye
2013-03-28 21:27 ` Sebastien Vauban
2013-03-28 21:51 ` Thomas S. Dye
2013-03-29 8:24 ` Stefan Vollmar
2013-03-29 9:25 ` Achim Gratz
2013-03-29 9:34 ` feng shu
2013-03-29 2:33 ` Eric Abrahamsen [this message]
2013-03-29 2:43 ` Thomas S. Dye
2013-03-29 3:14 ` Eric Abrahamsen
2013-03-29 7:18 ` Achim Gratz
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87li97gciz.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.