[mcclim-devel] Drei - a replacement for Goatee
Troels Henriksen
athas at sigkill.dk
Sat Nov 4 21:55:29 UTC 2006
For a while, I have been working on something I call Drei (acronym
currently ambiguous - I like Drei Replaces EINE's Inheritor
personally, but Drei Reimplements Emacs Internals is also nice). It's
a CLIM editing component based on Climacs, that I have used to
implement a text-editor gadget, text-field gadget and input-editor
(input-editing stream) for McCLIM. I would like to commit this to
McCLIM, but due to the fairly large amount of code required (about
17.000 lines), I thought I'd post a description here first to allow
people to object, if they see a problem. Due to the large number of
added lines, and a few new directories, I have a hard time getting CVS
to create a patch. Instead, I have created a tarball containing my
modified McCLIM (with the Doc and Webpage folders removed to reduce
size). It is available here: http://sigkill.dk/code/mcclim-drei.tar.gz
Drei is basically Climacs, but everything that assumes it runs in a
dedicated editor application (such as buffer-switching functionality)
has been removed. Also, only Lisp syntax and Fundamental syntax is
included. Apart from this, a programmatic interface to Drei has been
created, as well as an implementation of the CLIM input-editing-stream
protocol (based on Goatee code, but extensively modified and
completely independent of Goatee) and a minor bit of indirection, that
makes requests for :text-editor and :text-field gadgets create Drei
gadget panes. Drei cannot be run as an independent application, but it
has been designed so that it would be easy to base Climacs on Drei.
Since Drei requires much of the functionality of ESA, I also intend to
add ESA to McCLIM. This has required me to do a bit of hacking around
in mcclim.asd because ESA normally requires McCLIM to be loaded, but
due to Drei, it is necessary to load ESA before McCLIM has been fully
loaded. Of course, a standard esa.asd is also provided, and while the
internals of ESA have been rather extensively modified (especially the
command processing code), the API should be fully
backwards-compatible.
Since Goatee deviates slightly from the CLIM spec, especially in the
input-editor, I have also patched a few places in McCLIM that rely on
internal Goatee implementation details or Goatee assumptions to be
more general. I have also added a switch variable
clim-internals::*use-goatee* (T by default) that switches between the
use of Drei and Goatee. Generally, the number of changes (as opposed
to additions) to the McCLIM code is extremely limited, except for the
input-editing.lisp file.
Here is a probably incomplete executive summary of some Drei/Goatee
details:
DREI PROS:
* Drei has more functionality than Goatee, including a proper buffer protocol
and the use of syntaxes (permitting, among other things,
syntax-highlighting).
* Drei is a better CLIM citizen - Goatee does not use command tables
to tie gestures to commands and does not permit the binding of a
sequence of gestures (such as C-x C-f) to a command. Drei uses a
number of perfectly normal CLIM command tables that the user can
freely define his own commands for. This could also be phrased as
"Drei is easier to customize".
* Drei has more commands than Goatee.
* Drei can print information in the minibuffer if one is
avaiable. When no minibuffer is available, Drei will attempt to use
the *pointer-documentation* stream (doesn't work very well yet,
though).
* Drei is flexible enough to be used anywhere - if you define an
editing command for Drei, it can be used in the input-editor,
text-editor gadgets and Climacs. Goatee does not (at the moment)
have enough functionality to be used for implementing something like
Climacs.
* The Drei text-editor gadget supports more options than the Goatee
gadget (everything in the CLIM spec I think).
* Drei supports arbitrary objects in the buffer. Check my customized
accept method for `expression' (the bottom of
Drei/input-editor.lisp) to see how this can be exploited.
* Drei has `add-input-editor-command'!
DREI CONS:
* Drei is _vastly_ slower than Goatee and uses way more memory. I
think the situation can improve by improving the
incremental-redisplay code, but in general, Drei will always be
slower because it does so much more (such as presentational output)
than Goatee.
* Drei is not as well tested as Goatee.
* Drei does not support linebreaks in noise-strings. This is fixable
with a moderate amount of work (it's related to the way Drei handles
redisplay - it gets surly and grumpy if anything but an explicit
#\Newline character causes a jump to the next line).
* Drei does not support input-editor-typeout (neither does Goatee
AFAIK, though).
So, what are your thoughts?
--
\ Troels "Athas"
/\ Henriksen
More information about the mcclim-devel
mailing list