最小的Emacs Lisp可执行文件

Emacs-devel里有个有意思的讨论:https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00750.html

基本上就是这个人想要个最小的Emacs Lisp解释器,用来跑一些他的Emacs Lisp脚本。结论是Window下最少只需要这些:

./bin
./bin/emacs.exe
./libexec
./libexec/emacs
./libexec/emacs/26.3
./libexec/emacs/26.3/x86_64-w64-mingw32
./share
./share/emacs
./share/emacs/26.3
./share/emacs/26.3/etc
./share/emacs/26.3/etc/charsets
./share/emacs/26.3/etc/charsets/8859-10.map
... a lot of map files goes here ..
./share/emacs/26.3/lisp
./share/emacs/26.3/lisp/simple.el
./share/emacs/26.3/lisp/term
./share/emacs/26.3/lisp/term/w32-win.el

(linux下估计区别不大,去掉x86_64-w64-mingw32w32-win.el在加点别的估计就成了。)

然后用emacs.exe跑:

C:\...> bin\emacs.exe --batch -Q --eval "(princ """This is cool!""")"
This is cool!
C:\...>

还有就是win下的emacs.exe很大,一百多M,但是用strip去掉debug信息可以削减到30M。

5 个赞

重新buid release版本应该小很多

strip这招不错,装了mingw64,可以strip -s emacs.exe,从120多MB变成不到10MB,看着就爽啊。原来的实在是太大了。

3 个赞