From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc-Oliver Ihm Subject: [babel] Is there an elisp-way to see the header-arguments, that are passed to a #+call-line ? Date: Sun, 05 Feb 2012 10:13:38 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtyAR-0003f3-VS for emacs-orgmode@gnu.org; Sun, 05 Feb 2012 04:13:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RtyAQ-00019z-N9 for emacs-orgmode@gnu.org; Sun, 05 Feb 2012 04:13:51 -0500 Received: from plane.gmane.org ([80.91.229.3]:32770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtyAQ-00019r-Gc for emacs-orgmode@gnu.org; Sun, 05 Feb 2012 04:13:50 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1RtyAO-0003br-9M for emacs-orgmode@gnu.org; Sun, 05 Feb 2012 10:13:48 +0100 Received: from p54a89351.dip0.t-ipconnect.de ([84.168.147.81]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 05 Feb 2012 10:13:48 +0100 Received: from marc-oliver.ihm by p54a89351.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 05 Feb 2012 10:13:48 +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 Hi again, is there an elisp-way to see the header-arguments, that are passed to a #+call-line ? (This relates to my previous question "[babel] #+call-line removes hlines and headings ?", but has shifted in subject, so I would like to start a new thread, which can be understood on its own ...) I have tried the internal variable "params", but that only gives me the header-arguments of the #+begin_src-block and NOT of the #+call-line. This is illustrated in the example below: #+call: parameters() :colnames yes #+results: parameters() | :colname-names | nil | |----------------+------------------| | :rowname-names | nil | | :result-params | (silent replace) | | :result-type | value | | :comments | | | :shebang | | | :cache | no | | :padline | | | :noweb | no | | :tangle | no | | :exports | code | | :results | silent | | :session | none | | :padnewline | yes | | :hlines | yes | | :colnames | no | | :result-type | value | | :result-params | (replace) | | :rowname-names | nil | | :colname-names | nil | #+name: parameters #+begin_src emacs-lisp (mapcar (lambda (x) (list (car x) (cdr x))) params) #+end_src #+results: parameters | :colname-names | nil | | :rowname-names | nil | | :result-params | (replace) | | :result-type | value | | :comments | | | :shebang | | | :cache | no | | :padline | | | :noweb | no | | :tangle | no | | :exports | code | | :results | replace | | :colnames | no | | :hlines | yes | | :padnewline | yes | | :session | none | The #+call line calls a #+begin_src-block named "parameters", which simple dumps the content of the params-variable, which contains all the header arguments. If I pass ":colnames yes" as a header argument, I nevertheless get dumped "no" in the example ! This is probably because the #+begin_src-block only has only access to its own header-arguments (via the variable "params"). Therefore my question: Is there any way to access the header-arguments of the #+call-line within the #+begin_src-block ? Maybe with the "params" variable or maybe any other way ? The reason I need to know this: The value of the header-argument ":colnames" of the #+call-line governs, whether the #+begin_src-block is expected to return a table with or without column-names; so to react accordingly (and not surprise users) I need to know within the #+begin_src-block the value of the ":colnames" header-argument from the #+call-line. Thanx a lot ! with kind regards, Marc-Oliver Ihm P.s.: Possible solutions I can think of: - Access the variable "params" not from the local scope but from the outer scope, however I do not know, if elisp allows this. - Pass the header-arguments of the #+call-line to the #+begin_src-block, but this would probably require a patch to babel. - Something even more elegant I just cannot figure out :-) Am 30.01.2012 17:10, schrieb Eric Schulte: > > To explain the cause (if not rationale) for the current behavior; when > executing a call line, an ephemeral code block is created at the point > of the call line. The result of the called function is passed into this > ephemeral block, and the output of the block is inserted into the > buffer. > > This is why call lines have *two* possible sets of header arguments, one > to pass to the original called code block, and one for local effect in > the ephemeral block. > > The reason the colnames header argument is required for the call line > and not the code block, is because hlines are only stripped when data > passes *into* a code block as a variable. In this case the 'hlines are > stripped when the table passes into the ephemeral code blocks. > > Hope the above is more illuminating that confusing, >