I have decided to check out Emacs, and I liked it very much. Now, I\'m using the Emacs Starter Kit, which sort of provides better defaults and some nice customizations to defaul
You can use the --batch
flag to recompile from the command line.
To recompile all, do
emacs --batch --eval '(byte-recompile-directory "~/.emacs.d")'
or to recompile a single file as from a Makefile,
emacs --batch --eval '(byte-compile-file "your-elisp-file.el")'
The command I use is M-x byte-force-recompile RET
, it then asks the directory so, for example, I give it ~/.emacs.d/elpa/
. It then recompiles everything in there, usually no need to delete .elc
files first or mess with it in other ways.
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.
For my using spacemacs, the command is spacemacs/recompile-elpa
. The command byte-recompile-directory
does not compile any file.
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)
Surprisingly, it doesn't add much to my startup time (unless something needs to be compiled).
To speed up my emacs, I first identified the slow parts using profile-dotemacs.el and then replaced them with autoloads.
This is swaying a bit from the question, but to solve the problem of loading slowly you can use the new daemon feature in Emacs 23.
"If you have a lot of support packages, emacs startup can be a bit slow. However, emacs 23 brings emacs --daemon, which enables you to start emacs in the background (for example when you log in). You can instantly pop up new emacs windows (frames) with emacsclient. Of course, you could already have an emacs 'server' in older versions, but being able to start it in the background makes this a much nicer solution"
From http://emacs-fu.blogspot.com/2009/07/emacs-23-is-very-near.html