emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: nicholas.dokos@hp.com
Cc: emacs-orgmode@gnu.org
Subject: Re: Code block evaluation export bug ?
Date: Wed, 09 Nov 2011 14:13:06 -0700	[thread overview]
Message-ID: <877h39dmot.fsf@gmail.com> (raw)
In-Reply-To: <32187.1319327474@alphaville.dokosmarshall.org> (Nick Dokos's message of "Sat, 22 Oct 2011 19:51:14 -0400")

I turns out the problem here is that the table was being parsed for
column headers twice, so the top two rows were both being taken as
column headers.  I've just pushed up a fix.

Best -- Eric

Nick Dokos <nicholas.dokos@hp.com> writes:

> Thomas S. Dye <tsd@tsdye.com> wrote:
>
>> Nick Dokos <nicholas.dokos@hp.com> writes:
>> 
>> > While testing my response to Viktor's question, I ran into a problem.
>> > I used a test file that is slightly modified from a previous post of Tom Dye's:
>> >
>> > * R tables
>> >
>> > #+TBLNAME: tbl-1
>> > | column1 | column2 |
>> > |---------+---------|
>> > |      45 |      34 |
>> > |      77 |      56 |
>> >
>> > #+tblname: tbl-2
>> > | col1 | col2 |
>> > |------+------|
>> > | a    | b    |
>> > | c    | d    |
>> >
>> > #+tblname: tbl-3
>> > | c1 | c2 |
>> > |----+----|
>> > | A  | B  |
>> > | C  | D  |
>> >
>> > #+BEGIN_SRC R :var x=tbl-1 :var y=tbl-2 :var z=tbl-3 :colnames yes :exports both :results value
>> > z
>> > #+END_SRC
>> >
>> >
>> >
>> > Evaluating the code block correctly produces the result
>> >
>> > ,----
>> > | 
>> > | #+results:
>> > | | c1 | c2 |
>> > | |----+----|
>> > | | A  | B  |
>> > | | C  | D  |
>> > `----
>> >
>> > but exporting (to ascii, PDF, HTML or ODT) chops off the first row of
>> > the result. For example, here
>> > is the ascii:
>> >
>> > ,----
>> > | 
>> > |   c1   c2  
>> > |  ----+----
>> > |   C    D   
>> > `----
>> > ...
>> 
>> Aloha Nick,
>> 
>> I see the same behavior.
>> 
>
> Here's a progress report on this: the call chain is
>
> ,----
> | 
> |   org-babel-process-params(((:comments . "") (:shebang . "") (:cache
> | . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports
> | . "both") (:results . "replace value") (:var x (45 34) (77 56))
> | (:var y ("a" "b") ("c" "d")) (:var z ("A" "B") ("C" "D")) (:session
> | . "none") (:rowname-names) (:result-type . value) (:result-params
> | "replace" "value") (:padnewline . "yes") (:hlines . "no") (:colnames
> | . "yes") (:colname-names (x "column1" "column2") (y "col1" "col2")
> | (z "c1" "c2"))))
> |   ...    
> |   (org-babel-exp-in-export-file lang (org-babel-process-params (org-babel-merge-params (nth 2 info) (\` ((:results \, (if silent "silent" "replace")))))))
> |   ...                  
> |   org-babel-exp-results(("R" "z" ((:cache . "no") (:colname-names (x
> | "column1" "column2") (y "col1" "col2") (z "c1" "c2")) (:colnames
> | . "yes") (:comments . "") (:exports . "both") (:hlines . "no")
> | (:noweb . "no") (:padline . "") (:padnewline . "yes")
> | (:result-params "replace" "value") (:result-type . value) (:results
> | . "replace value") (:rowname-names) (:session . "none") (:shebang
> | . "") (:tangle . "no") (:var x (45 34) (77 56)) (:var y ("a" "b")
> | ("c" "d")) (:var z ("A" "B") ("C" "D"))) "" nil 0) block nil
> | "6443d36b0252c9e3192f813429018760bee3c11d")
> |   ...                      
> |   org-babel-exp-do-export(("R" "z" ((:cache . "no") (:colname-names
> | (x "column1" "column2") (y "col1" "col2") (z "c1" "c2")) (:colnames
> | . "yes") (:comments . "") (:exports . "both") (:hlines . "no")
> | (:noweb . "no") (:padline . "") (:padnewline . "yes")
> | (:result-params "replace" "value") (:result-type . value) (:results
> | . "replace value") (:rowname-names) (:session . "none") (:shebang
> | . "") (:tangle . "no") (:var x (45 34) (77 56)) (:var y ("a" "b")
> | ("c" "d")) (:var z ("A" "B") ("C" "D"))) "" nil 0) block
> | "6443d36b0252c9e3192f813429018760bee3c11d")
> |   
> |   org-babel-exp-src-block(...)
> |                                             
> |   org-export-blocks-preprocess()
> |   ...            
> |   org-export-preprocess-string(...)
> |   ...    
> |   org-export-as-ascii(nil nil nil "*Org ASCII Export*")
> |   org-export-as-ascii-to-buffer(nil)
> |   ...
> |   org-export(nil)
> `----
>
> So far, so good: x, y and z are still 2x2 tables. But evaluating the last form, we get
>
> ((:var x (77 56)) (:var y ("c" "d")) (:var z ("C" "D"))
> (:colname-names (x "column1" "column2") (y "col1" "col2") (z "c1"
> "c2")) (:rowname-names) (:result-params "replace" "value" "replace"
> "value") (:result-type . value) (:comments . "") (:shebang . "")
> (:cache . "no") (:padline . "") (:noweb . "no") ...)
>
> The first row of each table has disappeared. Looks like a problem with org-babel-process-params.
> Eric, can you take a look?
>
> Thanks,
> Nick
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  reply	other threads:[~2011-11-09 21:13 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-22  7:36 [Bug] local variables definition at beginning of file is ignored Viktor Rosenfeld
2011-09-22  9:48 ` Viktor Rosenfeld
     [not found] ` <listuser36@googlemail.com>
2011-09-22 14:43   ` Nick Dokos
2011-09-22 14:58     ` Nick Dokos
2011-10-19 16:47   ` [babel] Verbatim output from SQL command Nick Dokos
2011-10-19 17:31     ` Viktor Rosenfeld
2011-10-19 17:34     ` Sebastien Vauban
2011-10-19 21:12   ` Export an org file from the command line in the background Nick Dokos
2011-10-19 22:28     ` Viktor Rosenfeld
2011-10-19 21:22   ` Code block evaluation export bug ? (was: Re: Export an org file from the command line in the background) Nick Dokos
2011-10-21  1:57     ` Code block evaluation export bug ? Thomas S. Dye
2011-10-21  2:42       ` Nick Dokos
2011-10-21  4:37         ` Nick Dokos
2011-10-22 23:51       ` Nick Dokos
2011-11-09 21:13         ` Eric Schulte [this message]
2011-11-09 21:55           ` Nick Dokos
2011-10-19 22:37   ` Export an org file from the command line in the background Nick Dokos
2011-11-16 15:52   ` Question regarding remote references in tables Nick Dokos
2011-11-16 16:40     ` Nick Dokos
2011-11-16 17:43     ` Viktor Rosenfeld
2011-12-13 22:16   ` Refresh of http://orgmode.org Nick Dokos
2012-07-07 20:02   ` Functions in SBE blocks Nick Dokos
2012-07-08  0:55     ` Viktor Rosenfeld
  -- strict thread matches above, loose matches on Subject: below --
2011-10-18 13:20 [babel] Verbatim output from SQL command Sebastien Vauban
2011-10-18 16:15 ` Eric Schulte
2011-10-19  9:19   ` Sebastien Vauban
2011-10-19 18:08     ` Eric Schulte
2011-10-20  8:03       ` Sebastien Vauban
2011-10-19 16:29 ` Viktor Rosenfeld
2011-10-19 16:21 Export an org file from the command line in the background Viktor Rosenfeld
2011-10-19 16:27 ` Jambunathan K
2011-10-19 20:14   ` Viktor Rosenfeld
2011-11-16 15:27 Question regarding remote references in tables Viktor Rosenfeld
2011-12-12 23:39 Refresh of http://orgmode.org Bastien
2011-12-13 17:25 ` Achim Gratz
2011-12-13 19:27   ` Bastien
2011-12-13 19:32     ` Nick Dokos
2011-12-13 20:27     ` Achim Gratz
2011-12-20 23:23       ` Bastien
2011-12-13 17:39 ` Samuel Wales
2011-12-13 18:39   ` Eric S Fraga
2011-12-13 18:59     ` Samuel Wales
2011-12-13 19:35     ` Bastien
2011-12-13 19:51       ` Samuel Wales
2011-12-14  8:49       ` Eric S Fraga
2011-12-13 19:33   ` Bastien
2011-12-13 21:50 ` Viktor Rosenfeld
2011-12-13 22:22   ` Bastien
2011-12-14  8:53     ` Eric S Fraga
2011-12-14 12:54     ` Viktor Rosenfeld
2011-12-14 17:40       ` Bastien
2011-12-14 18:15       ` Bastien
2011-12-14 22:10         ` Viktor Rosenfeld
2011-12-14 22:17           ` Eric Schulte
2011-12-14  1:19   ` Eric Schulte
2011-12-14 10:07     ` Bastien
2011-12-14 18:45       ` Eric Schulte
2011-12-15  4:11         ` Eric Schulte
2011-12-15 14:03           ` Bastien
2011-12-15 15:10             ` Eric Schulte
2011-12-15 15:18               ` Bastien
2011-12-15 15:26                 ` Eric Schulte
2011-12-15 15:44                   ` Bastien
2011-12-15 14:10         ` Bastien
2011-12-14 13:17   ` Stefan Vollmar
2011-12-14  2:30 ` Scott Randby
2011-12-15 13:10 ` Martyn Jago
2012-07-07 18:58 Functions in SBE blocks Viktor Rosenfeld

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=877h39dmot.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.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).