aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorGrégoire Jadi2013-06-15 11:24:47 +0200
committerGrégoire Jadi2013-06-15 11:24:47 +0200
commit1a0f9e5e80586e4f2157fdfecae250c5619edf15 (patch)
treedbf9c38ab630787db0e41667efc19715f7d571b4 /doc/lispref
parentc75684e7603cfea0ec91c63fca0187a5544245c8 (diff)
parent2a342ba649407875a265b8d56c9f7c3d87c4b43c (diff)
downloademacs-1a0f9e5e80586e4f2157fdfecae250c5619edf15.tar.gz
emacs-1a0f9e5e80586e4f2157fdfecae250c5619edf15.zip
Merge branch 'jave-xwidget' into xwidget
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/loading.texi36
2 files changed, 15 insertions, 26 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 259bf9a78a6..e14f7543443 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12013-06-13 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * loading.texi (Hooks for Loading): Don't document after-load-alist.
4 Document with-eval-after-load instead of eval-after-load.
5
12013-06-11 Xue Fuqiao <xfq.free@gmail.com> 62013-06-11 Xue Fuqiao <xfq.free@gmail.com>
2 7
3 * files.texi (File Name Expansion): Make the example more 8 * files.texi (File Name Expansion): Make the example more
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 5c92307f7d5..4c0f0d73e41 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -990,19 +990,18 @@ file that was just loaded.
990@end defvar 990@end defvar
991 991
992If you want code to be executed when a @emph{particular} library is 992If you want code to be executed when a @emph{particular} library is
993loaded, use the function @code{eval-after-load}: 993loaded, use the macro @code{with-eval-after-load}:
994 994
995@defun eval-after-load library form 995@defmac with-eval-after-load library body@dots{}
996This function arranges to evaluate @var{form} at the end of loading 996This macro arranges to evaluate @var{body} at the end of loading
997the file @var{library}, each time @var{library} is loaded. If 997the file @var{library}, each time @var{library} is loaded. If
998@var{library} is already loaded, it evaluates @var{form} right away. 998@var{library} is already loaded, it evaluates @var{body} right away.
999Don't forget to quote @var{form}!
1000 999
1001You don't need to give a directory or extension in the file name 1000You don't need to give a directory or extension in the file name
1002@var{library}. Normally, you just give a bare file name, like this: 1001@var{library}. Normally, you just give a bare file name, like this:
1003 1002
1004@example 1003@example
1005(eval-after-load "edebug" '(def-edebug-spec c-point t)) 1004(with-eval-after-load "edebug" (def-edebug-spec c-point t))
1006@end example 1005@end example
1007 1006
1008To restrict which files can trigger the evaluation, include a 1007To restrict which files can trigger the evaluation, include a
@@ -1014,16 +1013,16 @@ example, @file{my_inst.elc} or @file{my_inst.elc.gz} in some directory
1014@file{my_inst.el}: 1013@file{my_inst.el}:
1015 1014
1016@example 1015@example
1017(eval-after-load "foo/bar/my_inst.elc" @dots{}) 1016(with-eval-after-load "foo/bar/my_inst.elc" @dots{})
1018@end example 1017@end example
1019 1018
1020@var{library} can also be a feature (i.e., a symbol), in which case 1019@var{library} can also be a feature (i.e., a symbol), in which case
1021@var{form} is evaluated at the end of any file where 1020@var{body} is evaluated at the end of any file where
1022@code{(provide @var{library})} is called. 1021@code{(provide @var{library})} is called.
1023 1022
1024An error in @var{form} does not undo the load, but does prevent 1023An error in @var{body} does not undo the load, but does prevent
1025execution of the rest of @var{form}. 1024execution of the rest of @var{body}.
1026@end defun 1025@end defmac
1027 1026
1028Normally, well-designed Lisp programs should not use 1027Normally, well-designed Lisp programs should not use
1029@code{eval-after-load}. If you need to examine and set the variables 1028@code{eval-after-load}. If you need to examine and set the variables
@@ -1031,18 +1030,3 @@ defined in another library (those meant for outside use), you can do
1031it immediately---there is no need to wait until the library is loaded. 1030it immediately---there is no need to wait until the library is loaded.
1032If you need to call functions defined by that library, you should load 1031If you need to call functions defined by that library, you should load
1033the library, preferably with @code{require} (@pxref{Named Features}). 1032the library, preferably with @code{require} (@pxref{Named Features}).
1034
1035@defvar after-load-alist
1036This variable stores an alist built by @code{eval-after-load},
1037containing the expressions to evaluate when certain libraries are
1038loaded. Each element looks like this:
1039
1040@example
1041(@var{regexp-or-feature} @var{forms}@dots{})
1042@end example
1043
1044The key @var{regexp-or-feature} is either a regular expression or a
1045symbol, and the value is a list of forms. The forms are evaluated
1046when the key matches the absolute true name or feature name of the
1047library being loaded.
1048@end defvar