Re: [O] [BUG] ob-perl variable handling broken

2013-03-25 Thread Achim Gratz

Am 25.03.2013 01:27, schrieb Eric Schulte:

The attached patch fixes this behavior, however I haven't committed it
because I fear it would undo some of Achim's intentions in commit
ca125b82b.  I'll leave the final solution to Achim.


This should be the right solution, please commit.  However, the format 
string should be q(%s) and not q(~a) I suppose (unless my newsreader 
is fooling me).



Regards,
--
Achim.

(on the road :-)




Re: [O] [BUG] ob-perl variable handling broken

2013-03-25 Thread Eric Schulte
Achim Gratz strom...@nexgo.de writes:

 Am 25.03.2013 01:27, schrieb Eric Schulte:
 The attached patch fixes this behavior, however I haven't committed it
 because I fear it would undo some of Achim's intentions in commit
 ca125b82b.  I'll leave the final solution to Achim.

 This should be the right solution, please commit.

Committed.

 However, the format string should be q(%s) and not q(~a) I suppose
 (unless my newsreader is fooling me).


Sorry, I'm writing more Common Lisp than Emacs Lisp these days.

Cheers,



 Regards,

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



[O] [BUG] ob-perl variable handling broken

2013-03-24 Thread Rick Frankel

The commit ca125b82b changed a lot of the variable handling in
ob-perl, and it now will not accept tables as input. Below is an org
doc with an example, the error message and a backtrace.

rick
-

* Can't use table as input
#+name: t1
| 1 | 
#+begin_src perl :var t=t1 :results value
  $t
#+end_src  
** Error
mapconcat: Wrong type argument: sequencep, 1
#+begin_example
  org-babel-perl--var-to-perl(1)
  mapconcat(org-babel-perl--var-to-perl (1) )
  org-babel-perl--var-to-perl((1))
  mapconcat(org-babel-perl--var-to-perl ((1)) )
  org-babel-perl--var-to-perl(((1)))
  org-babel-perl--var-to-perl(((1)) t)
  #[(pair) \301A@\\207 [pair org-babel-perl--var-to-perl] 3]((t (1)))
  mapcar(#[(pair) \301A@\\207 [pair org-babel-perl--var-to-perl] 3] ((t 
(1
  org-babel-variable-assignments:perl(((:comments . ) (:shebang . ) (:cache 
. no) (:padline . ) (:noweb . no) (:tangle . no) (:exports . results) 
(:results . replace value) (:var t (1)) (:session . none) (:hlines . no) 
(:padnewline . yes) (:result-type . value) (:result-params value replace) 
(:rowname-names) (:colname-names)))
  org-babel-execute:perl($t ((:comments . ) (:shebang . ) (:cache . no) 
(:padline . ) (:noweb . no) (:tangle . no) (:exports . results) 
(:results . replace value) (:var t (1)) (:session . none) (:hlines . no) 
(:padnewline . yes) (:result-type . value) (:result-params value replace) 
(:rowname-names) (:colname-names)))
  org-babel-execute-src-block(nil (perl $t ((:comments . ) (:shebang . 
) (:cache . no) (:padline . ) (:noweb . no) (:tangle . no) (:exports 
. results) (:results . replace value) (:var t (1)) (:session . none) 
(:hlines . no) (:padnewline . yes) (:result-type . value) (:result-params 
value replace) (:rowname-names) (:colname-names))  nil 0))
  org-babel-execute-src-block-maybe()
  org-babel-execute-maybe()
  org-babel-execute-safely-maybe()
  run-hook-with-args-until-success(org-babel-execute-safely-maybe)
  org-ctrl-c-ctrl-c(nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)
#+end_example




Re: [O] [BUG] ob-perl variable handling broken

2013-03-24 Thread Eric Schulte
Rick Frankel r...@rickster.com writes:

 The commit ca125b82b changed a lot of the variable handling in
 ob-perl, and it now will not accept tables as input. Below is an org
 doc with an example, the error message and a backtrace.


The attached patch fixes this behavior, however I haven't committed it
because I fear it would undo some of Achim's intentions in commit
ca125b82b.  I'll leave the final solution to Achim.

Thanks for pointing this out,

From 0007d05de6e2d8994da01eee3ed4cec29ff43682 Mon Sep 17 00:00:00 2001
From: Eric Schulte schulte.e...@gmail.com
Date: Sun, 24 Mar 2013 18:25:42 -0600
Subject: [PATCH] print Perl variables with a format string

Don't use princ because it doesn't always return a string.

Thanks to Rick Frankel for pointing this out.

* lisp/ob-perl.el (org-babel-perl--var-to-perl): Print Perl variables
  with a format string.
---
 lisp/ob-perl.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-perl.el b/lisp/ob-perl.el
index 8bc84f0..a9db6ef 100644
--- a/lisp/ob-perl.el
+++ b/lisp/ob-perl.el
@@ -87,7 +87,7 @@ specifying a var of the same value.
 		(concat [\n
 			(mapconcat #'org-babel-perl--var-to-perl var )
 			prefix ]))
-		(concat q( (princ var) )))
+		(format q(~a) var))
 	  (unless (zerop org-babel-perl--lvl) ,\n)
 
 (defvar org-babel-perl-buffers '(:default . nil))
-- 
1.8.2


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