diff options
| author | Grégoire Jadi | 2013-06-15 11:24:47 +0200 |
|---|---|---|
| committer | Grégoire Jadi | 2013-06-15 11:24:47 +0200 |
| commit | 1a0f9e5e80586e4f2157fdfecae250c5619edf15 (patch) | |
| tree | dbf9c38ab630787db0e41667efc19715f7d571b4 /doc/lispref | |
| parent | c75684e7603cfea0ec91c63fca0187a5544245c8 (diff) | |
| parent | 2a342ba649407875a265b8d56c9f7c3d87c4b43c (diff) | |
| download | emacs-1a0f9e5e80586e4f2157fdfecae250c5619edf15.tar.gz emacs-1a0f9e5e80586e4f2157fdfecae250c5619edf15.zip | |
Merge branch 'jave-xwidget' into xwidget
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/loading.texi | 36 |
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 @@ | |||
| 1 | 2013-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 | |||
| 1 | 2013-06-11 Xue Fuqiao <xfq.free@gmail.com> | 6 | 2013-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 | ||
| 992 | If you want code to be executed when a @emph{particular} library is | 992 | If you want code to be executed when a @emph{particular} library is |
| 993 | loaded, use the function @code{eval-after-load}: | 993 | loaded, 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{} |
| 996 | This function arranges to evaluate @var{form} at the end of loading | 996 | This macro arranges to evaluate @var{body} at the end of loading |
| 997 | the file @var{library}, each time @var{library} is loaded. If | 997 | the 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. |
| 999 | Don't forget to quote @var{form}! | ||
| 1000 | 999 | ||
| 1001 | You don't need to give a directory or extension in the file name | 1000 | You 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 | ||
| 1008 | To restrict which files can trigger the evaluation, include a | 1007 | To 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 | ||
| 1024 | An error in @var{form} does not undo the load, but does prevent | 1023 | An error in @var{body} does not undo the load, but does prevent |
| 1025 | execution of the rest of @var{form}. | 1024 | execution of the rest of @var{body}. |
| 1026 | @end defun | 1025 | @end defmac |
| 1027 | 1026 | ||
| 1028 | Normally, well-designed Lisp programs should not use | 1027 | Normally, 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 | |||
| 1031 | it immediately---there is no need to wait until the library is loaded. | 1030 | it immediately---there is no need to wait until the library is loaded. |
| 1032 | If you need to call functions defined by that library, you should load | 1031 | If you need to call functions defined by that library, you should load |
| 1033 | the library, preferably with @code{require} (@pxref{Named Features}). | 1032 | the library, preferably with @code{require} (@pxref{Named Features}). |
| 1034 | |||
| 1035 | @defvar after-load-alist | ||
| 1036 | This variable stores an alist built by @code{eval-after-load}, | ||
| 1037 | containing the expressions to evaluate when certain libraries are | ||
| 1038 | loaded. Each element looks like this: | ||
| 1039 | |||
| 1040 | @example | ||
| 1041 | (@var{regexp-or-feature} @var{forms}@dots{}) | ||
| 1042 | @end example | ||
| 1043 | |||
| 1044 | The key @var{regexp-or-feature} is either a regular expression or a | ||
| 1045 | symbol, and the value is a list of forms. The forms are evaluated | ||
| 1046 | when the key matches the absolute true name or feature name of the | ||
| 1047 | library being loaded. | ||
| 1048 | @end defvar | ||