Support via Liberapay, GitHub or PayPal

Babel: Languages

Table of Contents

Babel Languages

Babel supports a growing number of programming languages. Table 1 lists supported languages, indicates how they are identified in Babel, and provides links to documentation and to other software required for full support. The Location column indicates how support for each language is distributed: core languages are distributed with Emacs; contrib languages are distributed in the Org-mode contrib directory because their copyright has not been assigned to the FSF; and package languages are distributed outside of Org-mode through the Emacs package system.

Table 1: Languages supported by Babel
Language Identifier Requirements Location
ABC abc abcm2ps, abc-mode core
Arduino arduino Arduino contrib
Asymptote asymptote Asymptote, asy-mode core
Awk awk AWK core
Axiom axiom, spad axiom, OpenAxiom, or FriCAS, axiom-environment package
C C none core
C# csharp mono contrib
C++ cpp none core
Calc calc none core
Clojure clojure Clojure, Clojure Mode, CIDER, Leiningen core
comint comint   core
Coq coq Coq, Proof General core
CSS css none core
D D D core
Ditaa ditaa ditaa (bundled with Org-mode) core
Dot (Graphviz) dot dot core
ebnf ebnf ebnf2ps core
Elixir elixir elixir, Erlang package
Emacs Lisp emacs-lisp none core
eshell eshell eshell core
Eukleides eukleides eukleides contrib
Fomus fomus fomus (music notation) contrib
Forth forth gforth core
Fortran F90 fortran core
Gnuplot gnuplot gnuplot, gnuplot-mode core
Google Translate translate google-translate package
Groovy groovy Apache Groovy core
Haskell haskell haskell, haskell-mode, inf-haskell, lhs2tex core
Haxe haxe Haxe package
hledger hledger hledger core
HTML browser PhantomJS, ob-browser.js package
http request http cURL package
Io io Io, java core
iPython ipython ob-python package
J J J, j-mode core
Java java Java core
Javascript js node.js core
Julia julia ess contrib
Kotlin kotlin Kotlin, kotlin-mode package
LaTeX latex latex, auctex, reftex core
Ledger ledger ledger core
Lilypond ly LilyPond core
Lisp lisp lisp, Slime core
Lisp Flavored Erlang lfe lfe package
lua lua lua core
Make makefile none core
Mathematica mathematica Mathematica contrib
Mathomatic mathomatic Mathomatic contrib
Matlab matlab MATLAB, matlab.el core
Maxima max Maxima, Common Lisp, gnuplot (optional) core
MongoDB mongo MongoDB package
Mscgen mscgen Mscgen core
Neo4j cypher neo4j, cypher-mode package
Objective Caml ocaml ocaml, tuareg-mode core
Octave octave Octave core
Org org none core
OZ oz Mozart which includes a major mode contrib
Perl perl perl, cperl-mode (optional) core
php php PHP contrib
Picolisp picolisp PicoLisp core
PlantUML plantuml PlantUML core
Processing processing Processing core
Prolog prolog SWI Prolog package
Python python python, python-mode (optional) core
R R R, ess-mode, tikzDevice core
rec rec GNU Recutils package
redis redis redis contrib
Ruby ruby ruby, irb, ruby-mode, inf-ruby mode core
Sass sass Sass, sass-mode core
Scala scala Scala package
Scheme scheme none core
sclang sclang SuperCollider contrib
Screen screen GNU Screen core
Sed sed sed core
shell shell a shell core
Shen shen Shen, shen-mode core
smiles smiles   contrib
spice spice SPICE contrib
SQL sql an RDBMS core
SQLite sqlite SQLite, sqlite3, SQL mode core
Stan stan Stan, Stan mode core
Standard ML sml Standard ML, sml-mode package
Stata stata Stata, ess-mode contrib
Tcl tcl tclsh contrib
Typescript typescript node.js, typescript package
Vala vala Vala core
VB.net vbnet mono, vbnc contrib

Note: Many languages in Table 1 require documentation. A template is provided in the worg git repository for the addition of language documentation.

Note also that there are some inconsistencies across languages.

Configure active languages

To add support for a particular language to your Babel installation first make sure that the requirements of the language are met, then you may customize the org-babel-load-languages variable, update the variable's value manually by adding1

(lang . t)

to its definition. A line like the following to explicitly remove support for a language.

(lang . nil)

Here is an example manual configuration of this variable, which enables support for R, and disables support for emacs-lisp.

;; active Babel languages
 '((R . t)
   (emacs-lisp . nil)))

Develop support for new languages

The core Babel functions (viewing, export, tangling, etc…) are language agnostic and will work even for languages that are not explicitly supported. Explicit language-specific support is required only for evaluation of code blocks in a language.

Babel is designed to be easily extended to support new languages. Language support is added by defining language-specific functions using a simple naming convention. The full suite of possible language specific functions need not be implemented all at once, but rather it is possible (and encouraged) to develop language-specific functionality in an incremental fashion – Babel will make use of those functions which are available, and will fail gracefully when functionality has not yet been implemented.

There is a short Emacs Lisp template (ob-template.el) which can be used as a starting point for implementing support for new languages. To fetch a copy of this file, please clone Worg:

~$ git clone https://code.orgmode.org/bzg/worg.git

You should find org-contrib/babel/ob-template.el.

Developers are encouraged to read the Org-mode contribution instructions in the hope that the language support can be included into the Org-mode core.



If you want to load a language in the contrib directory by specifying it in the org-babel-do-load-languages variable, then please follow these instructions. Otherwise, a language in the contrib directory must be explicitly required with e.g. (require 'ob-oz) after a path to the contrib directory has been added to load-path.

Documentation from the orgmode.org/worg/ 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.