views:

1163

answers:

2

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 default install of Emacs.

I have customized it a little, added some stuff like yasnippet, color-themes, unbound, and other stuff. I've set up a github repository where I keep all of the customizations so I can access them from multiple places or in case something goes bad and I lose my .emacs.d directory.

All of this is very nice, but there is a problem: Emacs takes about 1-2 seconds to load. AFAIK I can compile individual .el files with M-x byte-compile-file to .elc, and it works. But there are a lot of .el files, and I wonder if there is a way to compile them all with a simple command or something, to speed up the loading of Emacs. My Emacs is not always open, and I open and close it quite frequently, especially after I've set it up as a default editor for edit command in Total Commander to get used to it faster (yeah, windows xp here).

My Emacs version is 22.3. And yes, the default Emacs installation without any customizations fires up instantly.

I am not sure which version is preferred when loading, the .el or compiled .elc one by the way O.o

So, is there an elisp command or Emacs command line switch to make Emacs byte-compile everything in .emacs.d directory?

+17  A: 

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.

Laurynas Biveinis
It worked! Thanks! :)
Irwin1138
+6  A: 

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

mwilliams
I definitely gonna check this one one out. Thank you!
Irwin1138