aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2007-02-04 18:59:44 +0000
committerAlan Mackenzie2007-02-04 18:59:44 +0000
commit4bc6da22f6f08cc09edecf8e471e9914e5586350 (patch)
treef62d382fe693fd6f2aed7a686e783232b9acd5be
parentfad2430195513284e73be732a696390add2cfc7f (diff)
downloademacs-4bc6da22f6f08cc09edecf8e471e9914e5586350.tar.gz
emacs-4bc6da22f6f08cc09edecf8e471e9914e5586350.zip
(Hooks for Loading): Make the description of `eval-after-load' more
detailed, and amend the description of after-load-alist, in accordance with changes from 2006-05.
-rw-r--r--lispref/loading.texi42
1 files changed, 29 insertions, 13 deletions
diff --git a/lispref/loading.texi b/lispref/loading.texi
index 004989ad38a..3d294b2cc21 100644
--- a/lispref/loading.texi
+++ b/lispref/loading.texi
@@ -903,14 +903,29 @@ You can ask for code to be executed if and when a particular library is
903loaded, by calling @code{eval-after-load}. 903loaded, by calling @code{eval-after-load}.
904 904
905@defun eval-after-load library form 905@defun eval-after-load library form
906This function arranges to evaluate @var{form} at the end of loading the 906This function arranges to evaluate @var{form} at the end of loading
907library @var{library}, if and when @var{library} is loaded. If 907the file @var{library}, each time @var{library} is loaded. If
908@var{library} is already loaded, it evaluates @var{form} right away. 908@var{library} is already loaded, it evaluates @var{form} right away.
909Don't forget to quote @var{form}!
909 910
910If @var{library} is a string, it must exactly match the argument of 911You don't need to give a directory or extension in the file name
911@code{load} used to load the library. To get the proper results when an 912@var{library}---normally you just give a bare file name, like this:
912installed library is found by searching @code{load-path}, you should not 913
913include any directory names in @var{library}. 914@example
915(eval-after-load "edebug" '(def-edebug-spec c-point t))
916@end example
917
918To restrict which files can trigger the evaluation, include a
919directory or an extension or both in @var{library}. Only a file whose
920absolute true name (i.e., the name with all symbolic links chased out)
921matches all the given name components will match. In the following
922example, @file{my_inst.elc} or @file{my_inst.elc.gz} in some directory
923@code{..../foo/bar} will trigger the evaluation, but not
924@file{my_inst.el}:
925
926@example
927(eval-after-load "foo/bar/my_inst.elc" @dots{})
928@end example
914 929
915@var{library} can also be a feature (i.e.@: a symbol), in which case 930@var{library} can also be a feature (i.e.@: a symbol), in which case
916@var{form} is evaluated when @code{(provide @var{library})} is called. 931@var{form} is evaluated when @code{(provide @var{library})} is called.
@@ -932,19 +947,20 @@ customizations if you don't feel they must meet the design standards for
932programs meant for wider use. 947programs meant for wider use.
933 948
934@defvar after-load-alist 949@defvar after-load-alist
935This variable holds an alist of expressions to evaluate if and when 950This variable, an alist built by @code{eval-after-load}, holds the
936particular libraries are loaded. Each element looks like this: 951expressions to evaluate when particular libraries are loaded. Each
952element looks like this:
937 953
938@example 954@example
939(@var{filename} @var{forms}@dots{}) 955(@var{regexp-or-feature} @var{forms}@dots{})
940@end example 956@end example
941 957
942The function @code{load} checks @code{after-load-alist} in order to 958The key @var{regexp-or-feature} is either a regular expression or a
943implement @code{eval-after-load}. 959symbol, and the value is a list of forms. The forms are evaluated when
960the key matches the the absolute true name of the file being
961@code{load}ed or the symbol being @code{provide}d.
944@end defvar 962@end defvar
945 963
946@c Emacs 19 feature
947
948@ignore 964@ignore
949 arch-tag: df731f89-0900-4389-a436-9105241b6f7a 965 arch-tag: df731f89-0900-4389-a436-9105241b6f7a
950@end ignore 966@end ignore