ob-doc-lisp.org 4.8 KB

Org Mode support for Common Lisp

Template Checklist [12/12] noexport


  • [X] Revise #+TITLE:
  • [X] Indicate #+AUTHOR:
  • [X] Add #+EMAIL:
  • [X] Revise banner source block [3/3]
  • [X] Add link to a useful language web site
  • [X] Replace "Language" with language name
  • [X] Find a suitable graphic and use it to link to the language
  • web site
  • [X] Write an Introduction
  • [X] Describe Requirements and Setup
  • [X] Replace "Language" with language name in Org Mode Features for Language Source Code Blocks
  • [X] Describe Header Arguments
  • [X] Describe support for Sessions
  • [X] Describe Result Types
  • [X] Describe Other differences from supported languages
  • [X] Provide brief Examples of Use
  • According to [[http://en.wikiquote.org/wiki/Lisp_programming_language][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:


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.

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

Result Types


All result types are supported.

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:

(princ message)

Hello World!

Links to Tutorials and Other Resources

On-line Lisp books include an introductory comic book, a dead-sexy introduction and tutorial, and a comprehensive study of advanced Lisp techniques. Highly recommended.