From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rick Frankel Subject: Re: [BUG] :colnames not applied to #+call input Date: Tue, 02 Jul 2013 10:32:07 -0400 Message-ID: <7280541f4853fd4d21eeb275148fc4e8@mail.rickster.com> References: <3b90682f4749fc6cd9a5db0981f7f20a@mail.rickster.com> <8761wvkv0b.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu1cs-00065o-Vj for emacs-orgmode@gnu.org; Tue, 02 Jul 2013 10:32:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uu1cl-00043b-NX for emacs-orgmode@gnu.org; Tue, 02 Jul 2013 10:32:14 -0400 Received: from [204.62.15.78] (port=44484 helo=mail.rickster.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uu1cl-00043H-KF for emacs-orgmode@gnu.org; Tue, 02 Jul 2013 10:32:07 -0400 In-Reply-To: <8761wvkv0b.fsf@gmail.com> 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: Eric Schulte Cc: emacs-orgmode On 2013-06-30 19:21, Eric Schulte wrote: > Rick Frankel writes: > > it seems that the :colnames header is not being respected on parsing > the > input > to a `#+call:' line containing arguments, but is being applied to the > output! > > For example: > > #+BEGIN_SRC org > * Identity > #+name: table > | a | b | c | > |---+---+---| > | 1 | 2 | 3 | > > #+name: identity > #+BEGIN_SRC emacs-lisp :var table=table :colnames yes > (mapcar 'identity table) > #+END_SRC > > Emacs Lisp handles the :colnames header argument differently than other > languages, hence the "Note that the behavior of the ':colnames' header > argument may differ across languages." phrase in the manual. If you > remove ":colnames yes" from the emacs-lisp code block in your example > everything should work fine. I understand the differing handling of ':colnames' in different langauages, but you "solution" does not address the issue of not being able to call the block. It would mean handling the header and hline in the called block in all cases. The problem i am addressing is that the :colnames argument to the original source block is being applied on the reassembly of the output regardless of the value of the :colnames argument to the call line. This is a regresssion since 7.9 (see the 7.9 example at the end of this message). Let's try a different example to make the issue clearer. Given the same table, and the method: #+name: map #+BEGIN_SRC emacs-lisp :var table=table :colnames yes (mapcar (lambda (row) (mapcar '1+ row)) table) #+END_SRC The results are: #+RESULTS: map | a | b | c | |---+---+---| | 2 | 3 | 4 | If I call the function w/o a table argument i get the same results. However, if i try to pass the table argument, i get the following errors: /mapcar: Wrong type argument: number-or-marker-p, "a"/ on: #+call: map(table=table) #+call: map(table=table) :colnames yes #+call: map[:colnames yes](table=table) :colnames yes /Wrong type argument: sequencep, 1/ on: #+call: map(table=table[2:-1]) (since the (now one row) table is turned into a list. So there is no way to call this function with a single-row table as an argument. If we have the following table instead: #+name: table2 | a | b | c | |---+---+---| | 1 | 2 | 3 | | 4 | 5 | 6 | we get: #+name: map2 #+BEGIN_SRC emacs-lisp :var table=table2 :colnames yes (mapcar (lambda (row) (mapcar '1+ row)) table) #+END_SRC #+RESULTS: map2 | a | b | c | |---+---+---| | 2 | 3 | 4 | | 5 | 6 | 7 | #+call: map2(x="") #+RESULTS: map2(x="") | a | b | c | |---+---+---| | 2 | 3 | 4 | | 5 | 6 | 7 | #+call: map(table=table2[2:-1]) #+RESULTS: map(table=table2[2:-1]) | a | b | c | |---+---+---| | 2 | 3 | 4 | | 5 | 6 | 7 | which looks right, but we shouldn't have any header on the above results as we have (supposedly) stripped it from the input with the slice). Here' are the results from 7.9.3f. Note that calling the source block with a single row table is still impossible in 7.9, as the slice is still turned into a list, and the :colnames argument is also not being applied to the input (but is only being applied to the output if specified in the call line): #+name: map2 #+BEGIN_SRC emacs-lisp :var table=table2 :colnames yes (mapcar (lambda (row) (mapcar '1+ row)) table) #+END_SRC #+RESULTS: map2 | a | b | c | |---+---+---| | 2 | 3 | 4 | | 5 | 6 | 7 | #+call: map2(x="") #+RESULTS: map2(x="") | 2 | 3 | 4 | | 5 | 6 | 7 | #+call: map2(x="") :colnames yes #+RESULTS: map2(x=""):colnames yes | a | b | c | |---+---+---| | 2 | 3 | 4 | | 5 | 6 | 7 | #+call: map(table=table2[2:-1]) #+RESULTS: map(table=table2[2:-1]) | 2 | 3 | 4 | | 5 | 6 | 7 | #+call: map(table=table2[2:-1]) :colnames yes #+RESULTS: map(table=table2[2:-1]):colnames yes | a | b | c | |---+---+---| | 2 | 3 | 4 | | 5 | 6 | 7 |