Could Emacs be rewritten in Python?

Neil Hodgson nhodgson at bigpond.net.au
Mon Apr 7 05:47:55 EDT 2003


Patrick K. O'Brien:

> The Scintilla text control (written in C and wrapped in wxPython by a
> control called wxStyledTextCtrl) handles the on-screen representation
> and user-manipulation of the text.  So that part is actually easy.
> Just read in a file, feed it to Scintilla, and go.  The next step is
> wrapping all this in an Emacs-like framework.

   What Scintilla doesn't give you though, is simple direct access to the
document (buffer) objects and their text - instead you have to go through a
view object. This was a design decision based on the styles of API that
could be easily exposed from the target widget technologies. A better
approach would be to provide an "object model" API that provided access to
the sub-objects, particularly the document objects. An object model API can
be implemented as a facade over the existing flat API although there will be
a cost in complexity and possibly speed. Some of the techniques used here
include invisible view objects playing the part of document objects or the
use of accessor objects (like the WindowAccessor and DocumentAccessor clases
inside Scintilla) to provide higher bandwidth interaction with document
text.

   The kinds of operation where you want fast access to the buffer contents
include regular expression search and replace where it would be best to use
Python's builtin RE library. Don't use Scintilla's very primitive RE code
except as a temporary measure to get the editor running.

   Neil






More information about the Python-list mailing list