Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Common Lisp implemented in Emacs Lisp.
Emacs Lisp Common Lisp
Branch: master
Failed to load latest commit information.
contrib Rename .cl to .lisp.
src Fix a few minor bugs.
.gitignore Start support for making an ELPA package.
BUGS Move code from CVS to git.
COPYING add GPL and placeholder for installation instructions
HACKING Move code from CVS to git.
HOWTO no longer necessary to compile interactive functions
INSTALL Move code from CVS to git.
Makefile Start support for making an ELPA package.
README Move code from CVS to git.
batch.el provide standard I/O streams when running tests
cl-arrays.el use XEmacs' character type when available
cl-characters.el remove stale TODO
cl-compile.el fix EVAL-WHEN checks for COMPILE and LOAD
cl-conditions.el remember which condition handlers were active before a new condition …
cl-conses.el (setf nth) bugfix
cl-environment.el compile interpreted functions before disassembling, as per spec
cl-eval.el improve diagnostic of calling an undefined function
cl-evaluation.el bugfix for DEFMACRO
cl-filenames.el add '**' as namestring syntax for :wild-inferiors
cl-files.el support :wild-inferiors in DIRECTORY and use PATHNAME-MATCH-P to filt…
cl-flow.el improve type checking in apply
cl-format.el apologize for the stupid implementation
cl-hash.el replace calls to VALUES with faster cl:values macro
cl-iteration.el improve DOLIST to use DO in the implementation
cl-loop.el add LOOP for/as arithmetic
cl-numbers.el add tests; move bignum test from cl-numbers.el there
cl-objects.el add new file for CLOS and implement the UNBOUND-SLOT condition
cl-packages.el expand defpackage to a call to %defpackage
cl-printer.el pretty print DEFUN
cl-reader.el fix bug in left-paren-reader; make read-from-string return position a…
cl-sequences.el don't provide (setf subseq) to EL code
cl-streams.el fix bug in left-paren-reader; make read-from-string return position a…
cl-strings.el add missing (
cl-structures.el provide DEFSTRUCT to CL code
cl-subtypep.el fix errors signalled by xemacs' compiler
cl-symbols.el support interactive interpreted functions
cl-system.el evaluate (kw <emacs flavour>) to get a keyword in *features*
cl-typep.el temporary dummy definition of INTERPRETED-FUNCTION-P
cl-types.el COERCE can compile lambda expressions
emacs-cl change EMACS to plain 'emacs'
emacs-cl-pkg.el Start support for making an ELPA package.
func.el improve compilation of lambda lists
interaction.el set the Emacs Lisp variable standard-output to a function that prints…
load-cl.el test in GNU Emacs 19.34
populate.el add COMPILE and COMPILE-FILE
tests.el provide standard I/O streams when running tests
tests.lisp fix bug in left-paren-reader; make read-from-string return position a…
utils.el new utility: count-tree


Emacs Common Lisp is an implementation of Common Lisp, written in
Emacs Lisp.  It does not yet purport to conform to the ANSI standard
since, among other things, CLOS, and pretty printing are missing.
However, most other Common Lisp features like lexical closures,
packages, readtables, multiple values, bignums, adjustable arrays,
etc, are present.  At this stage many bugs remain and error checking
is sparse.

This implementation provides a Common Lisp environment, separate from
Emacs Lisp, running in Emacs.  It does not intend to extend Emacs Lisp
with Common Lisp functionality; however, Common Lisp functions compile
to byte code, so Emacs Lisp functions can call Common Lisp functions
and vice versa.

All Emacs Lisp data can be passed unchanged to Common Lisp functions,
except vectors, which are used to implement various Common Lisp types
not present in Emacs Lisp.  An Emacs Lisp vector should be converted
to a Common Lisp vector by calling cl-vector.

To convert a Common Lisp vector back to Emacs Lisp, call el-vector.
Common Lisp strings and bit vectors should be converted by el-string
and el-bool-vector or el-bit-vector (depending on your Emacs flavour).

There is a mailing list for discussion about Emacs Common Lisp.  Go to to subscribe.

See INSTALL for usage instructions.  See HOWTO for some hints on how
to do common tasks.

Some algorithms and messages are from SBCL and Gareth McCaughan.
Notes on the internals of the implementation follows:


Mapping from Emacs Lisp object types to Common Lisp object types:

EL type			CL type
bit-vector (XEmacs)	simple-bit-vector
bool-vector (GNU Emacs)	simple-bit-vector
character (XEmacs)	character
compiled-function	compiled-function
cons			cons
float			single-float
hash-table		hash-table
integer			fixnum
string			simple-string
subr			compiled-function
symbol			symbol
vector			various, type in first element

Common Lisp objects represented by Emacs Lisp vectors:

bignum			[BIGNUM <n0> <n1> ...]
ratio			[RATIO <numerator> <denominator>]
complex			[COMPLEX <realpart> <imagpart>]
character		[CHARACTER <code>]
string			[STRING <size> <string> <offset> <fill-pointer>]
char-array		[char-array <dimensions> <elements> <offset>]
bit-vector		[BIT-VECTOR <size> <elements> <offset> <fill-pointer>]
bit-array		[bit-array <dimensions> <elements> <offset>]
simple-vector		[SIMPLE-VECTOR <elt> ...]
vector			[VECTOR <size> <elements> <offset> <fill-pointer>]
array			[ARRAY <dimensions> <elements> <offset>]
interpreted-function	[INTERPRETED-FUNCTION <fn> <env> <name>]
instance of class C	[C <slot> ...]


Emacs feature wish list:

 * Hash tables.  Done in later versions.

 * Weak hash tables.  Done in later versions.

 * A function that returns the address of an object, for implementing
   print-unreadable-object :identity t.

 * A function that returns the amount of processor time used, for
   implementing get-internal-run-time.

 * A way to portably embed information in byte-code objects.


There are problems with the cl:function macro when its output appears
in compiled files:

 * When applied to a byte-code function the result will be printed
   with the #[...] syntax.  That works, but separate invokations of
   cl:function will result in distinct, though equal, code vectors.

 * When's applied to a subr, the result will be printed with the
   #<subr ...> syntax, which will raise a syntax error when loaded.

In general, Emacs' byte compiler doesn't preserve object identity,
which is a problem.  Here's another case:

 * This merges the two distinct strings into one object:
   (byte-compile `(lambda () (foo ,(copy-seq "abc") ,(copy-seq "abc"))))
Something went wrong with that request. Please try again.