Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 24: Installing Emacs Add-Ons

Previous HourNext Hour

Sections in this Hour:

 

Loading Techniques

Autoloading is the most common method of activating an add-on mode. This method is very efficient because the actual Lisp code is not loaded until the functions in the mode are actually needed. When Emacs starts up and reads your .emacs file, it deals with autoload statements (such as the two in the preceding example) not by loading the Lisp file, but by remembering the name of the file in case it is needed during the editing session.

There are some Emacs add-ons that are intended to be activated when Emacs starts and remain active throughout the session. The load-library function loads a Lisp file, and a similar function called require loads a file only if it hasn't already been loaded. These two statements are used as follows:


(load-library 'name)
(require 'name)

In the preceding examples, name is the filename of the Lisp file without the .el or .elc extension.

Another function that you will occasionally encounter is provide. provide is used when you need to make a specific feature in a Lisp file available. The statement looks similar to the following:


(provide 'name)

Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 24: Installing Emacs Add-Ons

Previous HourNext Hour

Sections in this Hour: