[O] Calling a source block with raw results

2015-01-04 Thread Xavier Garrido

Dear Orgers,

The following shell function lists the files within a directory and for 
each file, write a org piece of code to include it.


#+NAME: org-figure-to-slide
#+HEADERS: :var title=Empty title
#+HEADERS: :var dir=./figures :var ext=*.pdf
#+HEADERS: :var options=
#+BEGIN_SRC sh
  if [ ! -d ${dir} ]; then
  echo ${dir} is not a directory !
  exit 1
  fi
  for i in ${dir}/${ext}; do
  echo * ${title}
  if [ ${options} !=  ]; then
  echo :PROPERTIES:
  echo ${options}
  echo :END:
  fi
  echo #+BEGIN_CENTER
  echo #+ATTR_LATEX: :width \linewidth
  echo [[file:${i}]]
  echo #+END_CENTER
  done
#+END_SRC

The basic use of such function is for a beamer presentation, each 
headline corresponds to a figure.


Since I am explicitly writing all the org code, I would like to call the 
function and gets a *raw* results by doing


#+CALL: org-figure-to-slide[:exports none :results raw]()

The problem is when executing the call line, the result is always embeds 
between #+begin_example/#+end_example code block given something like


 #+RESULTS:
#+begin_example
* Empty title
#+BEGIN_CENTER
#+ATTR_LATEX: :width \linewidth
[[file:./figures/timeline0.pdf]]
#+END_CENTER
* Empty title
#+BEGIN_CENTER
#+ATTR_LATEX: :width \linewidth
[[file:./figures/timeline1.pdf]]
#+END_CENTER
#+end_example

I want to remove the #+begin_example/#+end_example but I do not find any 
header arguments that achieve that (I have tested almost all of them). 
Moreover when I read =ob-core= code I do not understand why the function 
=org-babel-examplify-region= (responsible for the add of example block) 
is called since I set a raw results.


The only (bad) way I have found is to set the variable 
=org-babel-min-lines-for-block-output= to nil but then I get big 
troubles when exporting the result.


Can someone give some advice on how to get a pure raw results from a 
source block ?


Thanks a lot for your help,
Xavier



Re: [O] Calling a source block with raw results

2015-01-04 Thread Thomas S. Dye
Aloha Xavier,

Xavier Garrido xavier.garr...@gmail.com writes:

 Since I am explicitly writing all the org code, I would like to call the 
 function and gets a *raw* results by doing

 #+CALL: org-figure-to-slide[:exports none :results raw]()

I think the problem is that you are specifying :results raw as an
'inside header argument' rather than an 'end header argument'.  Inside
header arguments affect ow the code block is evaluated.  End header
arguments affect how the results are incorporated into the Org mode
buffer.  See section 14.5 of the manual.

Does the following call line do what you want?

#+CALL: org-figure-to-slide() :results raw

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] Calling a source block with raw results

2015-01-04 Thread Xavier Garrido

Hi Tom,

Le 04/01/2015 21:29, Thomas S. Dye a écrit :

Aloha Xavier,

Xavier Garrido xavier.garr...@gmail.com writes:


Since I am explicitly writing all the org code, I would like to call the
function and gets a *raw* results by doing

#+CALL: org-figure-to-slide[:exports none :results raw]()


I think the problem is that you are specifying :results raw as an
'inside header argument' rather than an 'end header argument'.  Inside
header arguments affect ow the code block is evaluated.  End header
arguments affect how the results are incorporated into the Org mode
buffer.  See section 14.5 of the manual.

Does the following call line do what you want?

#+CALL: org-figure-to-slide() :results raw



Thanks for your quick answer. Nevertheless, adding :results raw at the 
end changes the formatting output but embeds everything within paren. 
Given your advice, I am pretty closed to what I want to do by adding 
another :results raw command either as an inside header arguments or 
directly when declaring the =org-figure-to-slide= code like


#+NAME: org-figure-to-slide
#+HEADERS: :var title=Empty title
#+HEADERS: :var dir=./figures :var ext=*.pdf
#+HEADERS: :var options=
#+BEGIN_SRC sh :results raw
..
#+END_SRC

Thanks again for your help,
Xavier





hth,
Tom