Support via Liberapay

org-eval-light.el — Display result of evaluating code in various languages (light)

1. General

Org-eval-light enables the execution of source code embedded in org-mode files.

2. How to use it

2.1. Quick Example

As a quick demonstration of use of org-eval-light first load it as described below. Then place a #+begin_src block like that below in an org-file on your system. Place the cursor inside of the block (in this case on the same line as the word date) and press \C-c\C-c calling org-eval-light-current-snippet. This will run the date command in your shell, and will place the output into your org file after the block. In the case of short output like below, org-eval-light will use the consise : style comments, but larger output (the cutoff default to 10 lines, but can be changed by setting the org-eval-light-example-size-cutoff variable) will be placed in an example block.

#+begin_src shell

2.2. Loading it (No surprises here)

The easiest way is by

M-x customize-apropos org-modules

Check the line for eval-light. This will cause it to be loaded every time you start org-mode.

You'll still have to load it manually the first time.

Of course, you can also just try it out by loading it manually.

If you prefer to manually customize your emacs then make sure that the path to org's contrib directory is in your load-path and add the following to your .emacs.

(require 'org-eval-light)

2.3. Adding new source-code types

org-eval-light is extensible. If you would like to add a new type of source code to org-eval-light you may do so by adding the name of your new lang (let say new_lang) to the org-eval-light-interpreters variable. You will then need to add a new conditional statement to the org-eval-light-code function (note: you should only try this if you are willing to get your hands dirty with some elisp).

If you add a new code type, and get it working please share your changes with the mailing list.

3. Credits

Eric Schulte adapted org-eval-light from org-eval, with much-appreciated code and advice from Carsten Dominik.

Documentation from the website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples and css stylesheets are licensed under the GNU General Public License v3 or later.