Down with Emacs Lisp: Dynamic Scope Analysis Matthias Neubauer Michael Sperber Institut fur¨ Informatik Wilhelm-Schickard-Institut fur¨ Informatik Universitat¨ Freiburg Universitat¨ Tubingen¨
[email protected] [email protected] ABSTRACT comparatively little focus on significant improvements of the It is possible to translate code written in Emacs Lisp or an- Emacs Lisp interpreter. other Lisp dialect which uses dynamic scoping to a more On the other hand, recent years have seen the advent modern programming language with lexical scoping while of a large number of extension language implementations largely preserving structure and readability of the code. The of full programming languages suitable for the inclusion in biggest obstacle to such an idiomatic translation from Emacs application software. Specifically, several current Scheme Lisp is the translation of dynamic binding into suitable in- implementations are technologically much better suited as stances of lexical binding: Many binding constructs in real an extension language for Emacs than Emacs Lisp itself. programs in fact exhibit identical behavior under both dy- In fact, the official long-range plan for GNU Emacs is to namic and lexical binding. An idiomatic translation needs to replace the Emacs Lisp substrate with Guile, also a Scheme detect as many of these binding constructs as possible and implementation [28]. The work presented here is part of a convert them into lexical binding constructs in the target different, independent effort to do the same for XEmacs, a language to achieve readability and efficiency of the target variant of GNU Emacs which also uses Emacs Lisp as its code.