emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rick Frankel <rick@rickster.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [BUG] :colnames not applied to #+call input
Date: Tue, 09 Jul 2013 11:29:39 -0400	[thread overview]
Message-ID: <8070da9ba809ec401d102619dbb8c1a2@mail.rickster.com> (raw)
In-Reply-To: <87d2qzo8w8.fsf@gmail.com>

On 2013-07-03 13:23, Eric Schulte wrote:
> Currently colnames are not used for emacs-lisp code blocks (for
> historical reasons).  Unfortunately, call lines are executed by
> expanding first to a trivial emacs-lisp code block, which is then run 
> to
> collect and possibly re-package the results of the called function.
> Thus colnames do not work well in call lines.
> 
> I think the best solution here is to add colnames support to Emacs Lisp
> code blocks.  I can put this on my Org-mode queue, but can't promise to
> get to it any time soon.

I'm confused by this response, as the behavior exhibited by org-mode
seems to indicate that :colnames IS affecting emacs-lisp code blocks,
but inconsistenly affecting "called" code blocks -- only applying to the
output but not the input as exhibited in an example in a previous
email.  As to the above, given:

#+name: table1
| 1 | 2 | 3 |
|---+---+---|
| 4 | 5 | 6 |

and the code:

#+name: map1
#+BEGIN_SRC emacs-lisp :var table=table1 :colnames yes
(mapcar (lambda (row) (mapcar '1+ row)) table)
#+END_SRC

I get:

#+RESULTS: map1
| 1 | 2 | 3 |
|---+---+---|
| 5 | 6 | 7 |

and the `*Message*' buffer contains:
#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (map1)...

(table (quote ((4 5 6))))

Code block evaluation complete.
#+END_EXAMPLE

But, removing the :colnames argument:

#+name: map2
#+BEGIN_SRC emacs-lisp :var table=table1
(mapcar (lambda (row) (mapcar '1+ row)) table)
#+END_SRC

give the error "Wrong type argument: sequencep, hline", and the
message buffer shows:

#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (map2)...

(table (quote ((1 2 3) hline (4 5 6))))

Wrong type argument: sequencep, hline
#+END_EXAMPLE

Finally,

#+name: mapp:
#+BEGIN_SRC emacs-lisp :var table=table1
(mapcar (lambda (row) (if (listp row) (mapcar '1+ row) row)) table)
#+END_SRC

#+RESULTS: mapp:
| 2 | 3 | 4 |
|---+---+---|
| 5 | 6 | 7 |

and the message buffer contains:

#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (mapp:)...

(table (quote ((1 2 3) hline (4 5 6))))

Code block evaluation complete.
#+END_EXAMPLE


#+name: call1
#+call: map1()

works:

#+RESULTS: call1
| 1 | 2 | 3 |
|---+---+---|
| 5 | 6 | 7 |


with the message:

#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (map1)...

(table (quote ((4 5 6))))

((1 2 3) hline (5 6 7))
executing Emacs-Lisp code block (call1)...

(results (quote ((1 2 3) hline (5 6 7))))

Code block evaluation complete.
#+END_EXAMPLE
but:
#+name: call2
#+call: map1(table=table1)

Generates the following message:

#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (map1)...

(table (quote ((4 5 6))))

((1 2 3) hline (5 6 7))
executing Emacs-Lisp code block (call1)...

(results (quote ((1 2 3) hline (5 6 7))))

Code block evaluation complete.
Mark set [2 times]
#+END_EXAMPLE

rick

      reply	other threads:[~2013-07-09 15:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 17:23 [BUG] :colnames not applied to #+call input Rick Frankel
2013-06-30 23:21 ` Eric Schulte
2013-07-02 14:32   ` Rick Frankel
2013-07-03 17:23     ` Eric Schulte
2013-07-09 15:29       ` Rick Frankel [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=8070da9ba809ec401d102619dbb8c1a2@mail.rickster.com \
    --to=rick@rickster.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /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).