From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: #+call split into multiple lines? Date: Fri, 29 Mar 2013 10:33:56 +0800 Message-ID: <87li97gciz.fsf@ericabrahamsen.net> References: <86ip4bw6yd.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:49897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULP3F-0008T7-Kb for emacs-orgmode@gnu.org; Thu, 28 Mar 2013 22:28:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULP3E-0007pf-I0 for emacs-orgmode@gnu.org; Thu, 28 Mar 2013 22:28:21 -0400 Received: from plane.gmane.org ([80.91.229.3]:45199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULP3E-0007pZ-Br for emacs-orgmode@gnu.org; Thu, 28 Mar 2013 22:28:20 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ULP3W-0000b8-Gf for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 03:28:38 +0100 Received: from 114.250.125.74 ([114.250.125.74]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 29 Mar 2013 03:28:38 +0100 Received: from eric by 114.250.125.74 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 29 Mar 2013 03:28:38 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org "Sebastien Vauban" 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?