[emac] Rewriting Emacs in Clojure
Because it's there -- George Mallory
https://github.com/hraberg/deuce#readme
Emacs Lisp to Clojure
There are several issues (like dynamic scoping), but nothing too hard or exciting. This layer will work similar to shen.clj, that is, basically a simple source to source transformer between Emacs Lisp and Clojure. Emacs Lisp bytecode, and anything related to evaluation of Emacs Lisp in bare Emacs will simply be replaced with Clojure and not ported. Emacs Lisp is a more complex language than K Lambda (which underpins Shen) though, which also was designed specifically for porting.
The special forms of Emacs Lisp live in deuce.emacs-lisp.
C to Clojure
A large part of bare Emacs is pretty redundant in 2012, so this will be mapped to JVM languages, and exposed to Emacs Lisp as the same primitives it has come to know and love. A subset of the Emacs C code is dealing with buffers, regex and other editing specifics, which will be harder to just replace.
Bare impure Emacs is 203692 lines of C spread over 65 files and another 19912 lines of header files. There are around 1064 primitive defsubr in the minimal build.
Clojure placeholders for some of the Emacs primitives live under deuce.emacs. They are be generated by ./build-stubs using deuce.scaffold.
The actual porting of the C will be done using a tactic of avoidance until a function is needed, auto generation of its signatures second, and hand crafting the actual implementation last.
etrace can be linked to Emacs and when compiling with -finstrument-functions to get a crazy amount of tracing "insight" into what Emacs is doing. strace is another alternative to see what Emacs is doing system call-wise, like to simply see just what files it opens.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.36.224.236
Editor 近期熱門文章
PTT數位生活區 即時熱門文章