languages.org 19 KB

Babel Languages

:PROPERTIES: :CUSTOM_ID: langs :END:

Babel supports a growing number of programming languages. Table babel-languages lists supported languages, indicates how they are identified in Babel, and provides links to documentation and to other software required for full support. Note that the table is divided into sections by the location of the language support: the first section includes core languages distributed with Emacs; the second section includes contributed languages that have not assigned copyright to FSF; and the third section includes languages distributed through the Emacs package system.

Core
Language Identifier Documentation Requirements
ABC abc ob-doc-abc abcm2ps, abc-mode
Asymptote asymptote ob-doc-asymptote asymptote, asy-mode
Awk awk ob-doc-awk awk
C C ob-doc-C none
C++ cpp ob-doc-C none
Calc calc none
Clojure clojure ob-doc-clojure Clojure, Clojure Mode, CIDER, Leiningen
comint comint
Coq coq
CSS css ob-doc-css none
D D ob-doc-C D
Ditaa ditaa ob-doc-ditaa ditaa (bundled with Org-mode)
Dot (Graphviz) dot og-doc-dot dot
ebnf ebnf
Emacs Lisp emacs-lisp none
Forth forth gforth
Fortran F90 fortran
Gnuplot gnuplot ob-doc-gnuplot gnuplot, gnuplot-mode
Haskell haskell haskell, haskell-mode, inf-haskell, lhs2tex
Io io
J J ob-doc-J J, j-mode
Java java java
Javascript js node.js
LaTeX latex ob-doc-latex latex, auctex, reftex
Ledger ledger ob-doc-ledger ledger
Lilypond ly ob-doc-lilypond lilypond music notation
Lisp lisp ob-doc-lisp lisp, slime
Make makefile ob-doc-makefile none
Matlab matlab ob-doc-octave-matlab matlab, matlab.el
Maxima max ob-doc-maxima maxima, Common Lisp, gnuplot (optional)
Mscgen mscgen ob-doc-mscgen Mscgen
Objective Caml ocaml ocaml, tuareg-mode
Octave octave ob-doc-octave-matlab octave
Org org none
Perl perl perl, cperl-mode (optional)
Picolisp picolisp ob-doc-picolisp PicoLisp
PlantUML plantuml
Processing processing
Python python ob-doc-python python, python-mode (optional)
R R ob-doc-R R, ess-mode, tikzDevice
Ruby ruby ruby, irb, ruby-mode, inf-ruby mode
Sass sass sass, sass-mode
Scala scala scala
Scheme scheme none
Screen screen ob-doc-screen
Sed sed
shell shell a shell
Shen shen shen, shen-mode
SQL sql ob-doc-sql an RDBMS
SQLite sqlite ob-doc-sqlite SQLite, sqlite3, SQL mode
Stan stan ob-doc-stan Stan, Stan mode
Vala vala ob-doc-vala Vala
Contributed
Language Identifier Documentation Requirements
Eukleides eukleides ob-doc-eukleides eukleides
Fomus fomus fomus (music notation)
Groovy groovy
Julia julia ob-julia-doc ess
Mathematica mathematica
Mathomatic mathomatic ob-doc-mathomatic Mathomatic
OZ oz ob-doc-oz Mozart which includes a major mode
Stata stata ob-doc-stata Stata, ess-mode
Tcl tcl ob-doc-tcl tclsh
Emacs Package
Language Identifier Documentation Requirements
Axiom axiom, spad ob-axiom on bitbucket axiom, OpenAxiom, or FriCAS, axiom-environment
HTML browser ob-browser on github PhantomJS, ob-browser.js
Neo4j cypher ob-cypher on github neo4j, cypher-mode
Elixir elixir ob-elixir on github elixir, Erlang
http request http ob-http on github cURL
iPython ipython ob-ipython on github ob-python
Kotlin kotlin ob-kotlin on github Kotlin, kotlin-mode
Lisp Flavored Erlang lfe ob-lfe on github lfe
MongoDB mongo ob-mongo on github mongoDB
Prolog prolog ob-prolog on github SWI Prolog
rec rec ob-rec.el on github GNU Recutils
Standard ML sml ob-sml.el on github Standard ML, sml-mode
Google Translate translate ob-translate on github google-translate
Typescript typescript ob-typescript on github node.js, typescript

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

Configure active languages

:PROPERTIES: :CUSTOM_ID: configure :END:

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 (org-babel-do-load-languages 'org-babel-load-languages '((R . t) (emacs-lisp . nil)))

Develop support for new languages

:PROPERTIES: :CUSTOM_ID: develop :END:

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.

Footnotes

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.


  1. If you want to load a language in the =contrib= directory by