According to these posts:
one can somehow replace require
and load
statements in the .emacs
file to speed up the emacs start. However I don't know how to do this in detail.
For example I have (among other things) in my .emacs file the following require
and load
statements:
(load "auctex.el" nil t t)
(require 'alarm)
(require 'linked)
(load "nxhtml/autostart.el")
(require 'autoinsert)
(require 'recentf)
(require 'color-theme)
(load "~/.emacsaddons/emacs-color-theme-solarized/color-theme-solarized")
...
For alarm
and linked
there are corresponding files in a directory called .emacsaddons
, for nxhtml
there is a directory, for the others there are no corresponding files in .emacsaddons
. I didn't include all require
or load
statements from my .emacs
file in the example above, just a few where I feel that the steps for replacing them with autoload
will differ between them (for example because some have el
files unter .emacsaddons
and some doesn't, or because nxhtml
is a subdir of .emacsaddons
…).
How are the detailed steps to replace everything by autoload
functionality for improving the performance?
Best Answer
As a first step towards autoloading, I would suggest that you convert your explicit
load
commands with paths appended to the list of things that emacs should load, as in:With that at the top of your
.emacs
, you can call other things that depend on loading other files so that they will be found.Specifically for postponing loading files, for each
(require 'foo)
that you have in your.emacs
, you should replace that with something similar to:You may have to experiment (perhaps read) the code for the respective
.el
file to see what is the name that you need to put in place of'name-of-foo-mode
. The most common are'foo
or'foo-mode
, but there is inconsistency.In my case, I have these declarations close to the bottom of my
.emacs
:but some of the declarations that I had to
require
before I moved to autoloading were:So, as I said, you may have to do some experimentation or code reading, but, in the end, it is worth it, as it will save you some time if you invoke emacs frequently.