Various people have proposed an emacs-like editor written in Common
Lisp. This page collects together a few possibilities
Editors and code
- Climacs is an implementation of the Emacs text editor in Common Lisp with some very interesting features, like incremental re-parsing of the buffer according to syntax rules and automatic indentation of lisp code. At the moment, it is also the most actively developed of the cl-emacsen on this page. Climacs is based on the same philosophy of dividing functions and user commands as Hemlock.
Hemlock is an emacslike editor that comes with CMUCL, using
CLX. Some things are different from modern (X)Emacs, and said to be
more akin to older Emacsen. A lot is similar, though. The major
difference that users will first note is that M-x commands are
"Ordinary English Words" rather than
"hyphenated-lowercase-lisp-function-names". This has a lot to do with
how commands are implemented as something separate from 'interactive
functions' (ie, functions which call the interactive macro to add
themselves to the list of available commands). The ZWEI/Hemlock
design is actually much cleaner and clearly separates functions from
user commands. To the user, the difference is that they no longer
have to remember arbitrary function names, but instead just remember
ordinary 'names' for operations. As far as keybindings go most of the
ordinary Emacs bindings (movement, simple editing) are the same, but
more complicated commands (like code reformatting) are going to be
Portable Hemlock (phemlock) is a fork of Hemlock that's
intended to run on any ANSI CL that has CLX. Also includes an elisp
emulation package from Ingvar Mattsson: note that this is not the
same as the CLOCC package below
- Goatee is the text editing component for McCLIM. There's an
overlap between McCLIM and phemlock developers, so it's not impossible
that Phemlock will become CLIM-based and combine with Goatee
- CLOCC contains a package
that implements some part of elisp in CL.
- LiCE shows beginnings of another CL-based Emacs which can also run atop of Movitz.
(Perceived) problems with the existing GNU Emacs
- Slow GC
- Characters implemented as integers
- Dynamic scope everywhere (while conceding that it's essential to have
in some places)
- Craig Finseth's book, The Craft of Text
Editing, available in HTML form online. "Required reading about
the implementation of Emacs-type text editors."
- If you're looking for a starting point for a new Emacs design you might like to take a look at Deuce, an Emacs like editor written in the Dylan programming language. Dylan has a CLOS style object model and it shouldn't be too difficult to port Deuce to Common Lisp. It separates GUI from editor code and has other interesting features. For details, see Scott Mckay's post (he is the author of Deuce):
(URL: Newsgroup Post describing Deuce)
The source code to Deuce is available as part of the Functional Developer
release, or can be downloaded from the Gwydion
Dylan contributions directory. Features
- Lines are polymorphic. They can contain text, graphics, etc.
- There is the concept of 'Source containers' and 'source sections'. A buffer is composed of 'source sections' which can come from different contains. In a nutshell this means you can have a single buffer where different parts of that buffer come from different files. For example, Deuce uses this to display a single buffer containing all the methods for a generic function. Each method definition in the buffer comes from a different source file. Editing that section of the buffer edits the original file.
- The capability for graphics is included.
- A simple presentation framework is part of the design. Allowing 'live' objects in the editor.
- GUI presentation is separated from editor functionality allowing different GUI back ends to be used
- An interesting approach for a "CL-Emacs" would be for Emacs to be implemented as a set of processes, some being "display engines," others being loosely characterized as "buffer engines." Supposing Gnus had its own process, it might even block, and not slow down the other things going on. Erik Naggum had similar ideas.
- Kent Pitman describes some interesting features of Zmacs, the
Lisp machine editor here.
- Distel ("distributed emacs lisp"), an extension of Emacs Lisp with the Erlang language's essential concurrency constructs, plus a (fully non-blocking) implementation of Erlang's inter-node distribution protocol. Also Ermacs, a fully concurrent Emacs written in Erlang (both core and extensions).