emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Calling a source block with raw results
@ 2015-01-04 19:56 Xavier Garrido
  2015-01-04 20:29 ` Thomas S. Dye
  0 siblings, 1 reply; 3+ messages in thread
From: Xavier Garrido @ 2015-01-04 19:56 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

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

* Re: Calling a source block with raw results
  2015-01-04 19:56 Calling a source block with raw results Xavier Garrido
@ 2015-01-04 20:29 ` Thomas S. Dye
  2015-01-04 20:47   ` Xavier Garrido
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas S. Dye @ 2015-01-04 20:29 UTC (permalink / raw)
  To: Xavier Garrido; +Cc: emacs-orgmode@gnu.org

Aloha Xavier,

Xavier Garrido <xavier.garrido@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

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

* Re: Calling a source block with raw results
  2015-01-04 20:29 ` Thomas S. Dye
@ 2015-01-04 20:47   ` Xavier Garrido
  0 siblings, 0 replies; 3+ messages in thread
From: Xavier Garrido @ 2015-01-04 20:47 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode@gnu.org

Hi Tom,

Le 04/01/2015 21:29, Thomas S. Dye a écrit :
> Aloha Xavier,
>
> Xavier Garrido <xavier.garrido@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
>

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

end of thread, other threads:[~2015-01-04 20:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-04 19:56 Calling a source block with raw results Xavier Garrido
2015-01-04 20:29 ` Thomas S. Dye
2015-01-04 20:47   ` Xavier Garrido

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