emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
@ 2015-02-23 12:48 Daniele Pizzolli
  2015-02-23 12:57 ` John Kitchin
  0 siblings, 1 reply; 11+ messages in thread
From: Daniele Pizzolli @ 2015-02-23 12:48 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

my attempt to use org-mode for both interactive presentation and final
report was unsuccessful due to a series of bugs and nuisances.
Fortunately I can use the result of tangle.  Will report the issues
encountered to the list in the next few days.

Here is a minor one.

The following code, taken from [[info:org#Languages]] works if run after
manually selecting it and running with M-x eval-region.  But with M-x
org-babel-execute-src-block it triggers an error.  The *Messages* buffer
shows:

#+BEGIN_EXAMPLE
executing Emacs-Lisp code block...
orgtbl-to-orgtbl: Wrong type argument: listp, t
#+END_EXAMPLE


#+BEGIN_SRC emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . nil)
(R . t)))
#+END_SRC

#+BEGIN_SRC emacs-lisp
(org-version nil t)
#+END_SRC

#+RESULTS:
: Org-mode version 8.3beta (release_8.3beta-860-ge4da74 @ /home/vagrant/.emacs.d/el-get/org-mode/lisp/)

Best,
Daniele

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

* Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-23 12:48 [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t Daniele Pizzolli
@ 2015-02-23 12:57 ` John Kitchin
  2015-02-23 13:17   ` Daniele Pizzolli
  0 siblings, 1 reply; 11+ messages in thread
From: John Kitchin @ 2015-02-23 12:57 UTC (permalink / raw)
  To: Daniele Pizzolli; +Cc: emacs-orgmode

I am pretty sure this is a long-standing "feature".

Try this:
#+BEGIN_SRC emacs-lisp :results raw
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . nil)
  (R . t)))
#+END_SRC

I have never been able to use a babel block  that outputs a list of cons
cells without explicitly setting results to raw or code. The problem
here is your code evaluates to ((emacs-lisp) (R . t)), and the t somehow
gets interpreted like it should be a list, which it is not. So, it
cannot be made into a table for output, and you get your error.

Changing the header just bypasses this function and outputs the results
more directly.

Daniele Pizzolli writes:

> Hello,
>
> my attempt to use org-mode for both interactive presentation and final
> report was unsuccessful due to a series of bugs and nuisances.
> Fortunately I can use the result of tangle.  Will report the issues
> encountered to the list in the next few days.
>
> Here is a minor one.
>
> The following code, taken from [[info:org#Languages]] works if run after
> manually selecting it and running with M-x eval-region.  But with M-x
> org-babel-execute-src-block it triggers an error.  The *Messages* buffer
> shows:
>
> #+BEGIN_EXAMPLE
> executing Emacs-Lisp code block...
> orgtbl-to-orgtbl: Wrong type argument: listp, t
> #+END_EXAMPLE
>
>
> #+BEGIN_SRC emacs-lisp
> (org-babel-do-load-languages
> 'org-babel-load-languages
> '((emacs-lisp . nil)
> (R . t)))
> #+END_SRC
>
> #+BEGIN_SRC emacs-lisp
> (org-version nil t)
> #+END_SRC
>
> #+RESULTS:
> : Org-mode version 8.3beta (release_8.3beta-860-ge4da74 @ /home/vagrant/.emacs.d/el-get/org-mode/lisp/)
>
> Best,
> Daniele

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

* Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-23 12:57 ` John Kitchin
@ 2015-02-23 13:17   ` Daniele Pizzolli
  2015-02-23 15:43     ` John Kitchin
  0 siblings, 1 reply; 11+ messages in thread
From: Daniele Pizzolli @ 2015-02-23 13:17 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

John Kitchin writes:

> I am pretty sure this is a long-standing "feature".
>
> Try this:
> #+BEGIN_SRC emacs-lisp :results raw
> (org-babel-do-load-languages
> 'org-babel-load-languages
> '((emacs-lisp . nil)
>   (R . t)))
> #+END_SRC
>
> I have never been able to use a babel block  that outputs a list of cons
> cells without explicitly setting results to raw or code. The problem
> here is your code evaluates to ((emacs-lisp) (R . t)), and the t somehow
> gets interpreted like it should be a list, which it is not. So, it
> cannot be made into a table for output, and you get your error.
>
> Changing the header just bypasses this function and outputs the results
> more directly.

Hello John,

thanks for the explanation.

Unfortunately my lisp knowledge is too limited to understand you.  As a
naive org-mode user, if possible I do not want to be exposed to org
internals error, especially the confusing ones, where the custom code
works fine.  Maybe we can get a warning instead of an error?

It is not a really big issue, a newcomer can be confused, if not scared,
having an error on the fist babel usage.

Best,
Daniele

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

* Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-23 13:17   ` Daniele Pizzolli
@ 2015-02-23 15:43     ` John Kitchin
  2015-02-23 17:46       ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: John Kitchin @ 2015-02-23 15:43 UTC (permalink / raw)
  To: Daniele Pizzolli; +Cc: emacs-orgmode

>
> thanks for the explanation.
>
> Unfortunately my lisp knowledge is too limited to understand you.  As a
> naive org-mode user, if possible I do not want to be exposed to org
> internals error, especially the confusing ones, where the custom code
> works fine.  Maybe we can get a warning instead of an error?
>
> It is not a really big issue, a newcomer can be confused, if not scared,
> having an error on the fist babel usage.

I agree. Even for experienced people, this is pretty annoying. Something
as simple as


#+BEGIN_SRC emacs-lisp
'((1 . nil) (2 . 3))
#+END_SRC

fails with a cryptic error. While this works fine. I would vote for a
fall-back to code or even a plain string in this case.

#+BEGIN_SRC emacs-lisp :results code
'((1 . nil) (2 . 3))
#+END_SRC

#+RESULTS:
#+BEGIN_SRC emacs-lisp
((1)
 (2 . 3))
#+END_SRC



>
> Best,
> Daniele

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

* Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-23 15:43     ` John Kitchin
@ 2015-02-23 17:46       ` Nicolas Goaziou
  2015-02-23 18:07         ` John Kitchin
  2015-02-23 19:30         ` Daniele Pizzolli
  0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2015-02-23 17:46 UTC (permalink / raw)
  To: John Kitchin; +Cc: Daniele Pizzolli, emacs-orgmode

Hello,

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> I agree. Even for experienced people, this is pretty annoying. Something
> as simple as
>
>
> #+BEGIN_SRC emacs-lisp
> '((1 . nil) (2 . 3))
> #+END_SRC
>
> fails with a cryptic error. While this works fine. I would vote for a
> fall-back to code or even a plain string in this case.

Indeed. This should be fixed in
ad7b7efcdc2e0803cbf0257bb2588c8e8e1cac29.

If fall-backs to a plain string.

Thank you.


Regards,

-- 
Nicolas Goaziou

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

* Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-23 17:46       ` Nicolas Goaziou
@ 2015-02-23 18:07         ` John Kitchin
  2015-02-24 16:50           ` Nicolas Goaziou
  2015-02-23 19:30         ` Daniele Pizzolli
  1 sibling, 1 reply; 11+ messages in thread
From: John Kitchin @ 2015-02-23 18:07 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Daniele Pizzolli, emacs-orgmode

Fabulous! Thanks!

Nicolas Goaziou writes:

> Hello,
>
> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>> I agree. Even for experienced people, this is pretty annoying. Something
>> as simple as
>>
>>
>> #+BEGIN_SRC emacs-lisp
>> '((1 . nil) (2 . 3))
>> #+END_SRC
>>
>> fails with a cryptic error. While this works fine. I would vote for a
>> fall-back to code or even a plain string in this case.
>
> Indeed. This should be fixed in
> ad7b7efcdc2e0803cbf0257bb2588c8e8e1cac29.
>
> If fall-backs to a plain string.
>
> Thank you.
>
>
> Regards,

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

* Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-23 17:46       ` Nicolas Goaziou
  2015-02-23 18:07         ` John Kitchin
@ 2015-02-23 19:30         ` Daniele Pizzolli
  1 sibling, 0 replies; 11+ messages in thread
From: Daniele Pizzolli @ 2015-02-23 19:30 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, John Kitchin

Nicolas Goaziou writes:

> Hello,

[]

> Indeed. This should be fixed in
> ad7b7efcdc2e0803cbf0257bb2588c8e8e1cac29.
>
> If fall-backs to a plain string.
>
> Thank you.

Thanks to you for taking care so quickly!

Best,
Daniele

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

* Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-23 18:07         ` John Kitchin
@ 2015-02-24 16:50           ` Nicolas Goaziou
  2015-02-24 18:21             ` John Kitchin
  2015-02-24 23:36             ` [PATCH] was " Charles C. Berry
  0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2015-02-24 16:50 UTC (permalink / raw)
  To: John Kitchin; +Cc: Daniele Pizzolli, emacs-orgmode

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> Fabulous! Thanks!

BTW,

  #+BEGIN_SRC emacs-lisp
    '((a (b)))
  #+END_SRC

  #+RESULTS: foo
  | a | (b) |

Shouldn't we also return lists deeper than 2 levels as strings? Does it
even make sense to try formatting them into a table?

Regards,

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

* Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-24 16:50           ` Nicolas Goaziou
@ 2015-02-24 18:21             ` John Kitchin
  2015-02-24 23:36             ` [PATCH] was " Charles C. Berry
  1 sibling, 0 replies; 11+ messages in thread
From: John Kitchin @ 2015-02-24 18:21 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Daniele Pizzolli, emacs-orgmode

I don't have a strong opinion on this. My sense is if you get a table it
is fine, if not, you should get a string. Most important to me is no
error. Of second importance is usability of the result.

If I add this after the block, it works as expected for me, so the
current behavior seems ok to me.

#+BEGIN_SRC emacs-lisp :var d=foo :results code
d
#+END_SRC

I am not actually sure if a string is usable, without a read statement
for emacs-lisp.

Nicolas Goaziou writes:

> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>> Fabulous! Thanks!
>
> BTW,
>
>   #+BEGIN_SRC emacs-lisp
>     '((a (b)))
>   #+END_SRC
>
>   #+RESULTS: foo
>   | a | (b) |
>
> Shouldn't we also return lists deeper than 2 levels as strings? Does it
> even make sense to try formatting them into a table?
>
> Regards,

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

* [PATCH] was Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-24 16:50           ` Nicolas Goaziou
  2015-02-24 18:21             ` John Kitchin
@ 2015-02-24 23:36             ` Charles C. Berry
  2015-02-25 13:44               ` Nicolas Goaziou
  1 sibling, 1 reply; 11+ messages in thread
From: Charles C. Berry @ 2015-02-24 23:36 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Daniele Pizzolli, emacs-orgmode, John Kitchin

[-- Attachment #1: Type: TEXT/PLAIN, Size: 825 bytes --]

On Tue, 24 Feb 2015, Nicolas Goaziou wrote:

> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>> Fabulous! Thanks!
>
> BTW,
>
>  #+BEGIN_SRC emacs-lisp
>    '((a (b)))
>  #+END_SRC
>
>  #+RESULTS: foo
>  | a | (b) |
>
> Shouldn't we also return lists deeper than 2 levels as strings? Does it
> even make sense to try formatting them into a table?
>

My vote is no - it doesn't make sense. Let the user pick `:results list' 
or `:results pp' after it returns a string.

BTW, the string produced when a list cannot be rendered as a table ought 
to be removable.

The patch makes such strings removable. i.e.

#+BEGIN_SRC emacs-lisp
org-babel-load-languages
#+END_SRC

will have the ": " prefix or #+begin/end_example delimiters to allow later 
removal like this:

#+RESULTS:
: ((R . t) (latex . t) ... (sql) ...


HTH,

Chuck

[-- Attachment #2: make stringified lists removable --]
[-- Type: TEXT/PLAIN, Size: 1243 bytes --]

From b1179a79c6d72cc0beab6e7fd9774f49ea1bbbae Mon Sep 17 00:00:00 2001
From: Charles Berry <ccberry@ucsd.edu>
Date: Tue, 24 Feb 2015 15:12:53 -0800
Subject: [PATCH] ob-core.el: examplify list made into strings

* ob-core.el (org-babel-insert-result): When a list cannot be rendered
  as a table and is turned into a string make it removable if
  `:results replace' (the default) or `:results table' was specified.
---
 lisp/ob-core.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index f2062ef..4be10c1 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2299,7 +2299,10 @@ INFO may provide the values of these header arguments (in the
 			   "{{{results(" ")}}}"))
 		 ((and inlinep (member "file" result-params))
 		  (funcall wrap nil nil nil nil "{{{results(" ")}}}"))
-		 ((and (not (funcall proper-list-p result))
+		 ((and (not (and (funcall proper-list-p result)
+			    (org-every (lambda (e)
+					 (or (atom e) (funcall proper-list-p e)))
+				       result)))
 		       (not (member "file" result-params)))
 		  (let ((org-babel-inline-result-wrap
 			 ;; Hard code {{{results(...)}}} on top of customization.
-- 
1.9.3 (Apple Git-50)


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

* Re: [PATCH] was Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
  2015-02-24 23:36             ` [PATCH] was " Charles C. Berry
@ 2015-02-25 13:44               ` Nicolas Goaziou
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2015-02-25 13:44 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: Daniele Pizzolli, emacs-orgmode, John Kitchin

"Charles C. Berry" <ccberry@ucsd.edu> writes:

> BTW, the string produced when a list cannot be rendered as a table ought 
> to be removable.
>
> The patch makes such strings removable. i.e.
>
> #+BEGIN_SRC emacs-lisp
> org-babel-load-languages
> #+END_SRC
>
> will have the ": " prefix or #+begin/end_example delimiters to allow later 
> removal like this:
>
> #+RESULTS:
> : ((R . t) (latex . t) ... (sql) ...

Indeed. I applied a similar patch in
1493151b3fa37496dda12ecbcfc94501ceeafd81. Thank you.


Regards,

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

end of thread, other threads:[~2015-02-25 13:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-23 12:48 [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t Daniele Pizzolli
2015-02-23 12:57 ` John Kitchin
2015-02-23 13:17   ` Daniele Pizzolli
2015-02-23 15:43     ` John Kitchin
2015-02-23 17:46       ` Nicolas Goaziou
2015-02-23 18:07         ` John Kitchin
2015-02-24 16:50           ` Nicolas Goaziou
2015-02-24 18:21             ` John Kitchin
2015-02-24 23:36             ` [PATCH] was " Charles C. Berry
2015-02-25 13:44               ` Nicolas Goaziou
2015-02-23 19:30         ` Daniele Pizzolli

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).