emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* table not returned
@ 2012-03-27 20:02 Andreas Leha
  2012-03-27 20:27 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Leha @ 2012-03-27 20:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I have problems with the following table to be inserted into the org
mode buffer:

#+begin_src R :results table
  data.frame(parameter=c("parameter", "", "param1"),
             mean=c("mean ± sd", "", "1.1 ± 0.1"),
             median=c("median", "(minimum;maximum)", "1 (1;2)"))
#+end_src

#+results:

The problem seems to be the "(" as a first character in a cell.  Is
this a to-be-expected limitation of org-mode tables?

Regards,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: table not returned
  2012-03-27 20:02 table not returned Andreas Leha
@ 2012-03-27 20:27 ` Bastien
  2012-03-28 11:45   ` Andreas Leha
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2012-03-27 20:27 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> #+begin_src R :results table
>   data.frame(parameter=c("parameter", "", "param1"),
>              mean=c("mean  sd", "", "1.1  0.1"),
>              median=c("median", "(minimum;maximum)", "1 (1;2)"))
> #+end_src
>
> #+results:

I can't test this because of the  character.

Can you send something we can test?

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: table not returned
  2012-03-27 20:27 ` Bastien
@ 2012-03-28 11:45   ` Andreas Leha
  2012-03-28 12:45     ` Nick Dokos
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Leha @ 2012-03-28 11:45 UTC (permalink / raw)
  To: emacs-orgmode


Hi Bastien,

thanks for looking into this!


Bastien <bzg@gnu.org> writes:

> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> #+begin_src R :results table
>>   data.frame(parameter=c("parameter", "", "param1"),
>>              mean=c("mean  sd", "", "1.1  0.1"),
>>              median=c("median", "(minimum;maximum)", "1 (1;2)"))
>> #+end_src
>>
>> #+results:
>
> I can't test this because of the  character.
                                 ^^^^^
This character got lost on the mailing list.  I guess the offending
character was the plus-minus character.

This should be testable, I hope:

,----
| #+begin_src R :results table
|   data.frame(parameter=c("parameter", "", "param1"),
|              mean=c("mean +- sd", "", "1.1 +- 0.1"),
|              median=c("median", "(minimum;maximum)", "1 (1;2)"))
| #+end_src
| 
| #+results:
`----

Again, this works as expected, if "(minimum" is replaced by "minimum".

Regards,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: table not returned
  2012-03-28 11:45   ` Andreas Leha
@ 2012-03-28 12:45     ` Nick Dokos
  2012-03-28 13:26       ` Andreas Leha
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2012-03-28 12:45 UTC (permalink / raw)
  To: Andreas Leha; +Cc: nicholas.dokos, emacs-orgmode

Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote:

> 
> Hi Bastien,
> 
> thanks for looking into this!
> 
> 
> Bastien <bzg@gnu.org> writes:
> 
> > Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
> >
> >> #+begin_src R :results table
> >>   data.frame(parameter=c("parameter", "", "param1"),
> >>              mean=c("mean  sd", "", "1.1  0.1"),
> >>              median=c("median", "(minimum;maximum)", "1 (1;2)"))
> >> #+end_src
> >>
> >> #+results:
> >
> > I can't test this because of the  character.
>                                  ^^^^^
> This character got lost on the mailing list.  I guess the offending
> character was the plus-minus character.
> 
> This should be testable, I hope:
> 
> ,----
> | #+begin_src R :results table
> |   data.frame(parameter=c("parameter", "", "param1"),
> |              mean=c("mean +- sd", "", "1.1 +- 0.1"),
> |              median=c("median", "(minimum;maximum)", "1 (1;2)"))
> | #+end_src
> | 
> | #+results:
> `----
> 
> Again, this works as expected, if "(minimum" is replaced by "minimum".
> 

This happens in org-babel-import-elisp-from-file, when org-babel-string-read
is mapped on each row. To wit:

(org-babel-string-read "foo)") --> "foo)"

but

(org-babel-string-read "(foo)") --> Error

The backtrace for the error says:

,----
| Debugger entered--Lisp error: (void-function foo)
|   (foo)
|   eval((foo))
|   (if (and (not inhibit-lisp-eval) (member (substring cell 0 1) (quote ("(" "'" "`" "[")))) (eval (read cell)) (if (string= (substring cell 0 1) "\"") (read cell) (progn (set-text-properties 0 (length cell) nil cell) cell)))
|   (or (org-babel-number-p cell) (if (and (not inhibit-lisp-eval) (member (substring cell 0 1) (quote ("(" "'" "`" "[")))) (eval (read cell)) (if (string= (substring cell 0 1) "\"") (read cell) (progn (set-text-properties 0 (length cell) nil cell) cell))))
|   (if (and (stringp cell) (not (equal cell ""))) (or (org-babel-number-p cell) (if (and (not inhibit-lisp-eval) (member (substring cell 0 1) (quote ("(" "'" "`" "[")))) (eval (read cell)) (if (string= (substring cell 0 1) "\"") (read cell) (progn (set-text-properties 0 (length cell) nil cell) cell)))) cell)
|   org-babel-read("(foo)")
|   org-babel-string-read("(foo)")
`----

Nick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: table not returned
  2012-03-28 12:45     ` Nick Dokos
@ 2012-03-28 13:26       ` Andreas Leha
  2012-03-28 14:20         ` Nick Dokos
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Leha @ 2012-03-28 13:26 UTC (permalink / raw)
  To: emacs-orgmode

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

> Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote:
>
>> 
>> Hi Bastien,
>> 
>> thanks for looking into this!
>> 
>> 
>> Bastien <bzg@gnu.org> writes:
>> 
>> > Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>> >
>> >> #+begin_src R :results table
>> >>   data.frame(parameter=c("parameter", "", "param1"),
>> >>              mean=c("mean  sd", "", "1.1  0.1"),
>> >>              median=c("median", "(minimum;maximum)", "1 (1;2)"))
>> >> #+end_src
>> >>
>> >> #+results:
>> >
>> > I can't test this because of the  character.
>>                                  ^^^^^
>> This character got lost on the mailing list.  I guess the offending
>> character was the plus-minus character.
>> 
>> This should be testable, I hope:
>> 
>> ,----
>> | #+begin_src R :results table
>> |   data.frame(parameter=c("parameter", "", "param1"),
>> |              mean=c("mean +- sd", "", "1.1 +- 0.1"),
>> |              median=c("median", "(minimum;maximum)", "1 (1;2)"))
>> | #+end_src
>> | 
>> | #+results:
>> `----
>> 
>> Again, this works as expected, if "(minimum" is replaced by "minimum".
>> 
>
> This happens in org-babel-import-elisp-from-file, when org-babel-string-read
> is mapped on each row. To wit:
>
> (org-babel-string-read "foo)") --> "foo)"
>
> but
>
> (org-babel-string-read "(foo)") --> Error
>
> The backtrace for the error says:
>
> ,----
> | Debugger entered--Lisp error: (void-function foo)
> |   (foo)
> |   eval((foo))
> |   (if (and (not inhibit-lisp-eval) (member (substring cell 0 1)
> | (quote ("(" "'" "`" "[")))) (eval (read cell)) (if (string=
> | (substring cell 0 1) "\"") (read cell) (progn (set-text-properties 0
> | (length cell) nil cell) cell)))
> |   (or (org-babel-number-p cell) (if (and (not inhibit-lisp-eval)
> | (member (substring cell 0 1) (quote ("(" "'" "`" "[")))) (eval (read
> | cell)) (if (string= (substring cell 0 1) "\"") (read cell) (progn
> | (set-text-properties 0 (length cell) nil cell) cell))))
> |   (if (and (stringp cell) (not (equal cell ""))) (or
> | (org-babel-number-p cell) (if (and (not inhibit-lisp-eval) (member
> | (substring cell 0 1) (quote ("(" "'" "`" "[")))) (eval (read cell))
> | (if (string= (substring cell 0 1) "\"") (read cell) (progn
> | (set-text-properties 0 (length cell) nil cell) cell)))) cell)
> |   org-babel-read("(foo)")
> |   org-babel-string-read("(foo)")
> `----
>
> Nick

Hi Nick,

thanks for that analysis!  I had tried replacing "(" with "[" without
success.  Now I "know" why:

(org-babel-string-read "[foo)") --> Error

,----
| Debugger entered--Lisp error: (invalid-read-syntax ") or . in a vector")
|   read("[foo)")
|   org-babel-read("[foo)")
|   org-babel-string-read("[foo)")
|   eval((org-babel-string-read "[foo)") nil)
|   eval-last-sexp-1(nil)
|   eval-last-sexp(nil)
|   call-interactively(eval-last-sexp nil nil)
`----

Regards,
Andreas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: table not returned
  2012-03-28 13:26       ` Andreas Leha
@ 2012-03-28 14:20         ` Nick Dokos
  2012-04-03  6:21           ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2012-03-28 14:20 UTC (permalink / raw)
  To: Andreas Leha; +Cc: nicholas.dokos, emacs-orgmode

Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote:


> thanks for that analysis!  I had tried replacing "(" with "[" without
> success.  Now I "know" why:
> 
> (org-babel-string-read "[foo)") --> Error
> 
> ,----
> | Debugger entered--Lisp error: (invalid-read-syntax ") or . in a vector")
> |   read("[foo)")
> |   org-babel-read("[foo)")
> |   org-babel-string-read("[foo)")
> |   eval((org-babel-string-read "[foo)") nil)
> |   eval-last-sexp-1(nil)
> |   eval-last-sexp(nil)
> |   call-interactively(eval-last-sexp nil nil)
> `----
> 

BTW, two possible workarounds which "work" with org-babel-string-read:

(org-babel-string-read "[foo]") --> [foo]

(org-babel-string-read "'(bar)") --> (bar)

do *not* work in the original context, so the org-babel-string-read
problem is probably only part of the story.

Nick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: table not returned
  2012-03-28 14:20         ` Nick Dokos
@ 2012-04-03  6:21           ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2012-04-03  6:21 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Andreas Leha, emacs-orgmode, schulte eric

Hi Nick,

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

> BTW, two possible workarounds which "work" with org-babel-string-read:
>
> (org-babel-string-read "[foo]") --> [foo]
>
> (org-babel-string-read "'(bar)") --> (bar)
>
> do *not* work in the original context, so the org-babel-string-read
> problem is probably only part of the story.

Try this:

(org-babel-read "(bar)")     => error
(org-babel-read "(bar)" t)   => ok

What is at stake here is that perhaps `org-babel-read' should be more
clever in turning `inhibit-lisp-eval' automatically on in some contexts.
But Eric has the last word on this, I'm not familiar enough with the
code.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-03  6:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-27 20:02 table not returned Andreas Leha
2012-03-27 20:27 ` Bastien
2012-03-28 11:45   ` Andreas Leha
2012-03-28 12:45     ` Nick Dokos
2012-03-28 13:26       ` Andreas Leha
2012-03-28 14:20         ` Nick Dokos
2012-04-03  6:21           ` Bastien

Code repositories for project(s) associated with this 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).