You can now arrange to run a hook if a particular Lisp library is loaded.
The variable after-load-alist
is an alist of expressions to be
evalled when particular files are loaded. Each element looks like
(filename forms...)
.
When load
is run and the file name argument equals
filename, the forms in the corresponding element are
executed at the end of loading. filename must match exactly!
Normally filename is the name of a library, with no directory
specified, since that is how load
is normally called.
An error in forms does not undo the load, but does prevent execution of the rest of the forms.
The function eval-after-load
provides a convenient way to add
entries to the alist. Call it with two arguments, file and a
form to execute.
The function autoload
now supports autoloading a keymap.
Use keymap
as the fourth argument if the autoloaded function
will become a keymap when loaded.
There is a new feature for specifying which functions in a library should be autoloaded by writing special "magic" comments in that library itself.
Write `;;;###autoload' on a line by itself before the real
definition of the function, in its autoloadable source file; then the
command M-x update-file-autoloads automatically puts the
autoload
call into `loaddefs.el'.
You can also put other kinds of forms into `loaddefs.el', by writing `;;;###autoload' followed on the same line by the form. M-x update-file-autoloads copies the form from that line.