Could Emacs be rewritten in Python?

Alexander Schmolck a.schmolck at
Mon Apr 7 18:26:05 CEST 2003

Kim Petersen <kp at> writes:

> > 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).

Ahem, there are several thousand variables kicking about in global in emacs,
you want to copy them all for each function call?

How do your propose to handle the following efficiently:

(defun foo()
  (message "when foo is called folding is: %s" case-fold-search))
(defun bar()
  (message "when bar is called folding is: %s" case-fold-search)
  (let ((case-fold-search t))
  (message "now folding is: %s again" case-fold-search))

when bar is called folding is: nil
when foo is called folding is: t
now folding is: nil again


More information about the Python-list mailing list