Could Emacs be rewritten in Python?

Paul Rubin http
Sun Apr 6 13:27:41 EDT 2003


pobrien at orbtech.com (Patrick K. O'Brien) writes:
> If you were crazy enough to think that you could create a program
> along the lines of Emacs, but written in Python, how would you go
> about it?  How would you design the domain model for files, buffers,
> windows, and frames?  How would you allow the same level of
> customizability?  How would you map functions (or methods or whatever)
> to keys?  Any thoughts?

I think you're going to need some C extensions to represent buffers
similar to how Emacs does it.  It's hard to move blocks of characters
around in Python with the array module without constantly re-allocating 
the arrays.  Of course it can't be done with strings because Python
strings are immutable.

Aside from that, the general architecture can probably be similar to
Emacs.  You might want to use a multi-threaded interpreter to make
extensions more flexible (e.g. so they can respond to keystrokes while
doing other stuff).  You generally won't need as much C code as Emacs
used, because computers are much faster now than when Emacs was
written.  Python and Emacs Lisp are fairly similar in speed, I think.





More information about the Python-list mailing list