Add link to Org Babel section from Worg main page
[Worg.git] / org-contrib / org-eval-light.org
blob870de52fa4f8d531e0d98065bc7795b60d97d2f8
1 #+TITLE:     org-eval-light.el --- Display result of evaluating code in various languages (light)
2 #+OPTIONS:   ^:{} author:nil
3 #+STARTUP: odd
5 * General 
7 Org-eval-light enables the execution of source code embedded in
8 org-mode files.
11 * How to use it
13 ** Quick Example
15 As a quick demonstration of use of =org-eval-light= first [[* Loading it][load it]] as
16 described below.  Then place a =#+begin_src= block like that below in
17 an org-file on your system.  Place the cursor *inside* of the block
18 (in this case on the same line as the word =date=) and press
19 =\C-c\C-c= calling =org-eval-light-current-snippet=.  This will run
20 the =date= command in your shell, and will place the output into your
21 org file after the block.  In the case of short output like below,
22 =org-eval-light= will use the consise =:= style comments, but larger
23 output (the cutoff default to 10 lines, but can be changed by setting
24 the =org-eval-light-example-size-cutoff= variable) will be placed in
25 an example block.
27 : #+begin_src shell
28 :  date
29 : #+end_src
32 ** Loading it (No surprises here)
33 The easiest way is by 
35         M-x customize-apropos org-modules
37 Check the line for eval-light.  This will cause it to be loaded every
38 time you start org-mode.
40 You'll still have to load it manually the first time.
42 Of course, you can also just try it out by loading it manually.
44 If you prefer to manually customize your emacs then make sure that the
45 path to org's contrib directory is in your load-path and add the
46 following to your =.emacs=.
48 : (require 'org-eval-light)
51 ** Adding new source-code types
52 =org-eval-light= is extensible.  If you would like to add a new type
53 of source code to =org-eval-light= you may do so by adding the name of
54 your new lang (let say =new_lang=) to the
55 =org-eval-light-interpreters= variable.  You will then need to add a
56 new conditional statement to the =org-eval-light-code= function
57 (*note*: you should only try this if you are willing to get your hands
58 dirty with some elisp).
60 If you add a new code type, and get it working please share your
61 changes with the mailing list.
64 * Credits
66 Eric Schulte adapted org-eval-light from org-eval, with
67 much-appreciated code and advice from Carsten Dominik.