diff options
| author | Glenn Morris | 2012-11-17 17:38:42 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-11-17 17:38:42 -0800 |
| commit | 7351b73d45a2f6f33230e6725fdfdf9e122eff14 (patch) | |
| tree | 2e6153d48902f57bc279fce27736e484d537823e | |
| parent | 7f6705c313ce5054fdcbc457fa32b9680bcb11a7 (diff) | |
| download | emacs-7351b73d45a2f6f33230e6725fdfdf9e122eff14.tar.gz emacs-7351b73d45a2f6f33230e6725fdfdf9e122eff14.zip | |
Document eager macro expansion
* doc/lispref/loading.texi (How Programs Do Loading): Add eager macro expansion.
* doc/lispref/macros.texi (Expansion): Mention eager macro expansion.
* etc/NEWS: Related edit.
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/loading.texi | 19 | ||||
| -rw-r--r-- | doc/lispref/macros.texi | 4 | ||||
| -rw-r--r-- | etc/NEWS | 12 |
4 files changed, 34 insertions, 6 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index da82ece39c1..43ca9ac4aa5 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-11-18 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * loading.texi (How Programs Do Loading): Add eager macro expansion. | ||
| 4 | * macros.texi (Expansion): Mention eager macro expansion. | ||
| 5 | |||
| 1 | 2012-11-17 Glenn Morris <rgm@gnu.org> | 6 | 2012-11-17 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * minibuf.texi (Basic Completion): Mention misc completion-table funcs. | 8 | * minibuf.texi (Basic Completion): Mention misc completion-table funcs. |
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 3a511d34829..54acd0b4d4c 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi | |||
| @@ -113,6 +113,25 @@ When loading a source file (not compiled), @code{load} performs | |||
| 113 | character set translation just as Emacs would do when visiting the file. | 113 | character set translation just as Emacs would do when visiting the file. |
| 114 | @xref{Coding Systems}. | 114 | @xref{Coding Systems}. |
| 115 | 115 | ||
| 116 | @c This is referred to from the Macros chapter. | ||
| 117 | @c Not sure if it should be the other way round. | ||
| 118 | @cindex eager macro expansion | ||
| 119 | When loading an uncompiled file, Emacs tries to expand any macros | ||
| 120 | that the file contains (@pxref{Macros}). We refer to this as | ||
| 121 | @dfn{eager macro expansion}. Doing this (rather than deferring | ||
| 122 | the expansion until the relevant code runs) can significantly speed | ||
| 123 | up the execution of uncompiled code. Sometimes, this macro expansion | ||
| 124 | cannot be done, owing to a cyclic dependency. In the simplest | ||
| 125 | example of this, the file you are loading refers to a macro defined | ||
| 126 | in another file, and that file in turn requires the file you are | ||
| 127 | loading. This is generally harmless. Emacs prints a warning | ||
| 128 | (@samp{Eager macro-expansion skipped due to cycle@dots{}}) | ||
| 129 | giving details of the problem, but it still loads the file, just | ||
| 130 | leaving the macro unexpanded for now. You may wish to restructure | ||
| 131 | your code so that this does not happen. Loading a compiled file does | ||
| 132 | not cause macroexpansion, because this should already have happened | ||
| 133 | during compilation. @xref{Compiling Macros}. | ||
| 134 | |||
| 116 | Messages like @samp{Loading foo...} and @samp{Loading foo...done} appear | 135 | Messages like @samp{Loading foo...} and @samp{Loading foo...done} appear |
| 117 | in the echo area during loading unless @var{nomessage} is | 136 | in the echo area during loading unless @var{nomessage} is |
| 118 | non-@code{nil}. | 137 | non-@code{nil}. |
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi index 8be6a3fbcde..b0dee1bf215 100644 --- a/doc/lispref/macros.texi +++ b/doc/lispref/macros.texi | |||
| @@ -86,6 +86,10 @@ macro. | |||
| 86 | calls to other macros. It may even be a call to the same macro, though | 86 | calls to other macros. It may even be a call to the same macro, though |
| 87 | this is unusual. | 87 | this is unusual. |
| 88 | 88 | ||
| 89 | Note that Emacs tries to expand macros when loading an uncompiled | ||
| 90 | Lisp file. This is not always possible, but if it is, it speeds up | ||
| 91 | subsequent execution. @xref{How Programs Do Loading}. | ||
| 92 | |||
| 89 | You can see the expansion of a given macro call by calling | 93 | You can see the expansion of a given macro call by calling |
| 90 | @code{macroexpand}. | 94 | @code{macroexpand}. |
| 91 | 95 | ||
| @@ -923,13 +923,13 @@ Previously, they returned NaNs on some platforms but signaled errors | |||
| 923 | on others. The affected functions are acos, asin, tan, exp, expt, | 923 | on others. The affected functions are acos, asin, tan, exp, expt, |
| 924 | log, log10, sqrt, and mod. | 924 | log, log10, sqrt, and mod. |
| 925 | 925 | ||
| 926 | ** Interpreted files are eagerly macro-expanded during load. | 926 | +++ |
| 927 | ** Emacs tries to macroexpand interpreted (non-compiled) files during load. | ||
| 927 | This can significantly speed up execution of non-byte-compiled code, | 928 | This can significantly speed up execution of non-byte-compiled code, |
| 928 | but can also bump into harmless and previously unnoticed cyclic | 929 | but can also bump into previously unnoticed cyclic dependencies. |
| 929 | dependencies. These should not be fatal: they will simply cause the | 930 | These are generally harmless: they will simply cause the macro calls |
| 930 | macro-calls to be left for later expansion (as before), but will also | 931 | to be left for later expansion (as before), but will result in a |
| 931 | result in a warning ("Eager macro-expansion skipped due to cycle") | 932 | warning ("Eager macro-expansion skipped due to cycle") describing the cycle. |
| 932 | describing the cycle. | ||
| 933 | 933 | ||
| 934 | ** Miscellaneous new functions: | 934 | ** Miscellaneous new functions: |
| 935 | +++ | 935 | +++ |