help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Speed up Emacs startup


From: Anselm Helbig
Subject: Re: Speed up Emacs startup
Date: Tue, 22 Nov 2005 12:19:24 +0100
User-agent: Wanderlust/2.11.30 (Wonderwall) Emacs/21.4 Mule/5.0 (SAKAKI)

> Just a quick question which does not seem so obvious to be
> answered: is there an easy way to speed up Emacs launch without
> sacrificing the readability and shortness of the .emacs file?
> 
> I mean: I don't like the autoload statements where you need tens
> of lines instead of one require function call. Is it possible to
> write a modified "require" that would provide the same kind of
> effect (ie, load files only when they are truly needed OR when
> the system is idle)?

you can generate the autoloads automatically and put them in your
private loaddefs.el. elisp files have `magic comments' in their code
for this. unfortunately, there only is a mechanism to generate
autoloads for the emacs source tree (speaking of gnu emacs 21 here,
somebody correct/update me if i'm wrong), but you can adapt it for
your private elisp dir. it did something like this (untested, my real
solution was uglier):

(let ((source-directory my-lisp-dir))
  (update-autoloads-from-directories my-lisp-dir))

this way you fool update-autoloads-from-directories to think your
private lisp directory is the emacs source tree, and then have it
generate autoloads for that. a loaddefs.el is generated in your lisp
dir, in the subdirectory `lisp', which you should have created
before. 

(if you don't set/shadow `source-directory' then you probably won't be
able to write loaddefs.el, or your emacs' loaddefs.el will be
overwritten.)

the only line you have to add to your .emacs is something like

        (load (concat my-lisp-dir) "lisp/loaddefs.el")

i hope this solution is elegant enough for you. 8-)

regards, 

anselm


reply via email to

[Prev in Thread] Current Thread [Next in Thread]