Could Emacs be rewritten in Python?

Patrick K. O'Brien pobrien at orbtech.com
Sun Apr 6 16:28:47 EDT 2003


llothar at web.de (Lothar Scholz) writes:

> pobrien at orbtech.com (Patrick K. O'Brien) wrote in message
> news:<m2u1dcw22s.fsf at localhost.localdomain>...
> > Here is the background.  I'm working on a file editor (called
> > PyAlaMode) using wxPython and Scintilla.  It's an extension of the
> > PyCrust code base.  I've got a basic version working, and it
> > supports editing multiple files and all the usual, basic features.
> > But I want it to be as customizable and extensible as Emacs.  In
> > fact, I want to model it after Emacs, so that elisp code could be
> > rewritten in Python and work with PyAlaMode.  To do that, I've got
> > to support the same primitives as Emacs; expose files, buffers,
> > regions, and windows the same way Emacs does; handle the Emacs
> > keybindings and ability to remap keys, the same way Emacs does,
> > etc.
> 
> Then you have to present the same old and ugly user interface with a
> mini buffer as input line and so on. I don't see any reason at the
> moment for cloning EMACS. You should ask people why they like emacs
> as an editor.

Actually, we don't have to clone everything about the interface.  I'm
using wxPython, so the interface is pretty and more easily configured.
But some people actually like the minibuffer, so we'll need to support
something like it and something less ugly.  Heck, I'm actually running
three different versions of the interface now, and I only wrote the
code this week (minus the almost two year's worth of code in PyCrust).

> There are only a handful of features that are normally the reason to
> keep this as your primary editor. For me its the window handling C-X
> 1, the way to prefix commands with a repeat command, the macro
> recording and a the autoindentation with TAB.

Except everyone will likely disagree about what the handful of
features are.  ;-) In any case, I'm targeting the bare minimum to
start.

> To make clear, i'm using XEMACS 8 hours a day for years now. But
> it's absolutely losing ground compared to modern editors. And i
> don't think that extensibility in the emacs sense is really
> necessary today or a plus, because people want out of the box
> solutions that are specialized to their domain.

What would you like to see in a modern version?

The main reason I started PyAlaMode is that I wanted the same
autocompletion and calltips that I've got in the PyCrust shell, but
while I'm editing a file.  Those features are working now, and are
pretty sweet, if I do say so myself, since they are based on dynamic
namespaces updated whenever you want, one per buffer, with no
conflicts no matter how many buffers you have open, with automatic
reloading of imported modules.

That means if I have two modules open in PyAlaMode, moduleA.py and
moduleB.py, and moduleA.py contains the following import:

    import moduleB

And then I modify and save moduleB.py and switch back to moduleA.py
and update its namespace and type:

    moduleB.

I see a popup list of moduleB's new contents.  Same thing with
calltips.  Every time I change moduleB.py I just have to switch back
to moduleA and update its namespace (one keystroke combo or menu
selection).  Try doing that with Emacs.  ;-)

-- 
Patrick K. O'Brien
Orbtech      http://www.orbtech.com/web/pobrien
-----------------------------------------------
"Your source for Python programming expertise."
-----------------------------------------------




More information about the Python-list mailing list