In Emacs, what is byte-compilation?
C
Byte-compilation is a function of Emacs that transforms Lisp into byte-code. Byte-code, run by an interpreter in Emacs, can be executed more quickly than Lisp. However, because it isn't written in machine code, it can be directly transferred between machines without having to be recompiled. Functions byte-compiled by earlier versions of Emacs can be correctly interpreted by Emacs, but the opposite is not necessarily true.
To byte-compile a file, launch Emacs and enter: M-x byte-compile-file RET [file to byte-compile] Replace [file to byte-compile]
with the name of the file you want to compile. The compiler will take the file, which should end in the extension .el
, and create a byte-code version with the extension .elc
.
How do I byte-compile everything in my .emacs.d directory?
C-u 0 M-x byte-recompile-directory
will compile all the .el files in the directory and in all subdirectories below.
The C-u 0
part is to make it not ask about every .el file that does not have a .elc counterpart.
To automatically byte compile everything that needs byte compiling each time I start emacs, I put the following after my changes to load-path
at the top of my .emacs
file:
(byte-recompile-directory (expand-file-name "~/.emacs.d") 0)
posted on 2012-03-31 09:21 Richard.FreeBSD 阅读(286) 评论(0) 编辑 收藏 举报