UP | HOME

Support via Liberapay

Common Lisp Source Code Blocks in Org Mode

Org Mode support for Common Lisp

Introduction

According to John Foderaro, Lisp is a programmable programming language.

Requirements and Setup

By default Common Lisp source code blocks are evaluated by Babel with the Superior Lisp Interaction Mode for Emacs, or SLIME. SLIME supports many Common Lisp implementations and is compatible with GNU Emacs version 21 and later and with XEmacs version 21.

Optionally, Sylvester the Cat's Common Lisp IDE, or SLY can be used for evaluation. Specify SLY by setting org-babel-lisp-eval-fn to "sly-eval".

You'll need a working installation one of the many Common Lisp implementations supported by SLIME or SLY, and SLIME or SLY. Consult the installation instructions for the Common Lisp implementation of your choice. SLIME installation requires just a few lines in .emacs, as does SLY.

To configure Common Lisp source code blocks in Org mode, add the appropriate dotted pair to org-babel-load-languages:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((lisp . t)))

Org Mode Features for Common Lisp Source Code Blocks

Header Arguments

There are no language-specific default values for header arguments to Common Lisp source code blocks.

A single language-specific header argument is defined for Common Lisp source code blocks:

:package
a string that names a Common Lisp package within which to execute the source code block. The default value is :any, which will execute the source code block in the current package.

Sessions

By their nature, Common Lisp interpreters always run "sessions."

Result Types

All result types are supported.

Other

The SLIME session must be running when the Common Lisp source code block is executed.

Examples of Use

Start SLIME: M-x slime <RET>.

#+name: hello-world
#+header: :var message="Hello World!"
#+begin_src lisp
  (princ message)
#+end_src

Execute the source code block with C-c C-c to yield this result:

Hello World!

Links to Tutorials and Other Resources

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.