[Top][All Lists]

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

Re: How to Reduce Emacs Load Time

From: Nikolaj Schumacher
Subject: Re: How to Reduce Emacs Load Time
Date: Sun, 31 Aug 2008 13:26:45 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2.50 (darwin)

address@hidden (Pascal J. Bourguignon) wrote:

Another tip:
Use `eval-after-load' a lot.  With that you can load minor modes and
configurations only when a specific major mode has been (auto-)loaded.

I use this to load cedet only when cc-mode is loaded, for example.

> - don't load what you need, yet.  This means, instead of loading or
>   requiring the packages you may need, define autoloading functions.
>   Good packages will do that for you, when you require them, they load
>   only a file which defines autoloading functions, so you spend time
>   loading the package only when you try to run these functions.

I don't think /good/ packages do that, just /huge/ packages.
IHMO the proper thing for packages to do is just add ;;;###autoload
markers, so /you/ can generate the autoloads automatically, if you want
them (using `update-directory-autoloads').

Package managers like ELPA will do that step automatically when the
package is updated.

I actually find it annoying if packages have their own autoloading,
because I need to exclude them specifically.  Pretty much every other
package I can autoload automatically with something like this:  (My
actual code is more complicated, so this is just a prototype...)

(defun update-autoloads ()
  (dolist (file (directory-files package-dir t "[^.]" t))
    (when (file-directory-p file)
      (add-to-list 'loaddef-dirs file)))
  (add-to-list 'loaddef-dirs package-dir)

  (let ((generated-autoload-file autoload-file))
    (apply 'update-directory-autoloads loaddef-dirs)))

and then just
(ignore-errors (load autoload-file))

I only need to define manual autoloads for three packages or so...

Nikolaj Schumacher

reply via email to

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