[O] Problem with org-export to LaTeX and babel

2011-05-31 Thread Stefan-W. Hahn
Hello,

I tried to use org-mode the first time with LaTeX export and embedded
babel block. But it doesn't do the right thing.

Following test:

-- snip
* gnuplot example

  Just a test.

#+begin_src gnuplot :session none :file out.png
set terminal png
set xlabel gx;set ylabel gy;set zlabel gz
set grid xtics ytics
set view 0,0
plot cos(x)
#+end_src
-- snip

This in an org-mode file and than exporting to LaTeX I always get
following error message from babel:

 snip from *Messages*:
Export buffer: 
Exporting to LaTeX...
org-babel-exp processing...
executing Gnuplot code block...
gnuplot-mode 0.6.0 (gnuplot 4.4) -- report bugs with C-c C-u
split-string: Wrong type argument: stringp, nil
 snip

I'm using 
 GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
   of 2010-12-11 on brahms, modified by Debian
and
 org-mode
 commit cec8711a44a9a1ac6552546c05ec0623a2bf9e45

I tried to trace this down till

 org-babel-execute:gnuplot (body params)
   where params is nil.
 which ist called by
 org-babel-execute-src-block (optional arg info params)
   where params is nil
 which is called by
   org-babel-exp-results (info type optional silent hash)
 in this function (nth 2 info) does contain the scanned
 parameters, but org-babel-execute-src-block is called
 just with with two not three parameters.

After trying the patch:

diff --git a/.emacs-lisp/org-mode/ob-exp.el b/.emacs-lisp/org-mode/ob-exp.el
index 09e85ca..baccba5 100644
--- a/.emacs-lisp/org-mode/ob-exp.el
+++ b/.emacs-lisp/org-mode/ob-exp.el
@@ -262,7 +262,8 @@ inhibit insertion of results into the buffer.
   (equal hash (org-babel-exp-in-export-file (nth 0 info)
 (org-babel-result-hash info))
 (let ((lang (nth 0 info))
- (body (nth 1 info)))
+ (body (nth 1 info))
+ (params (nth 2 info)))
   ;; skip code blocks which we can't evaluate
   (when (fboundp (intern (concat org-babel-execute: lang)))
(org-babel-eval-wipe-error-buffer)
@@ -275,11 +276,11 @@ inhibit insertion of results into the buffer.
`((:results . ,(if silent silent replace)))
  (cond
   ((or (equal type 'block) (equal type 'inline))
-   (org-babel-execute-src-block nil info))
+   (org-babel-execute-src-block nil info params))
   ((equal type 'lob)
(save-excursion
  (re-search-backward org-babel-lob-one-liner-regexp nil t)
- (org-babel-execute-src-block nil info)
+ (org-babel-execute-src-block nil info params)
 
 (provide 'ob-exp)
 
it worked. But I'm not sure if my using of babel is correct and
if yes, wheter the patch will do the right thing in all usings 
babel. (I'm just learning to understand lisp programming.)

Any suggestions?

Stefan

-- 
Stefan-W. Hahn  It is easy to make things.
It is hard to make things simple.



Re: [O] Problem with org-export to LaTeX and babel

2011-05-31 Thread Eric S Fraga
Stefan-W. Hahn i...@s-hahn.de writes:

 Hello,

 I tried to use org-mode the first time with LaTeX export and embedded
 babel block. But it doesn't do the right thing.

 Following test:

 -- snip
 * gnuplot example

   Just a test.

 #+begin_src gnuplot :session none :file out.png
 set terminal png
 set xlabel gx;set ylabel gy;set zlabel gz
 set grid xtics ytics
 set view 0,0
 plot cos(x)
 #+end_src
 -- snip

[...]

 I'm using 
  GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
of 2010-12-11 on brahms, modified by Debian
 and
  org-mode
  commit cec8711a44a9a1ac6552546c05ec0623a2bf9e45

Works fine for me but I'm using a more recent version of org (see
signature) *and* I'm using emacs 24.0.x so a couple of
differences... although the former is likely more relevant than the
latter?


-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.331.g2422.dirty)