Could Emacs be rewritten in Python?
kp at kyborg.dk
Mon Apr 7 14:57:09 CEST 2003
Lothar Scholz wrote:
>>"comparable in power." The reason is that there is a ton of elisp
>>code out there, including most of Emacs itself, that could be
>>translated to work with PyAlaMode. My goal isn't to be able to
>>convert in a completely automated fashion, but close enough to be
>>attractive to both an elisp programmer and a Python programmer.
> Sorry, have you ever written a elisp program, something that is larger
> 100 lines. I can't think about a way to provide this in python without
> writting a lisp like interpreter. Remember that the scope of elisp
> variables for example are not lexical. This is something very hard to
> emulate in python.
Why would the variable scheme that elisp uses be tougher to emulate in
python than a lexical version ? From my pov it should make it a heck of
a lot easier (think of emacsen as having 1 global dictionary and 1
buffer specific dictionary for global/buffer local variables) then every
time you call a function in elisp - do a shallow copy of local variable
space (dictionary) and send it as the local vars - you can safely throw
away the dict after function returns).
eg. something like this:
# apply the args to the funargs (simple ignore :optional etc.)
Excuses made for misremembering how lisp actually does optional args and
> I would really suggest to look at the structure of keyhandling,
> keymaps and buffers. And then forget about lisp and design a good
> python editor.
More information about the Python-list