aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2006-02-28 03:01:57 +0000
committerLuc Teirlinck2006-02-28 03:01:57 +0000
commitfcaedd23eb5b8752cbd2083918c18a9436eee70a (patch)
treea7aaad557c1543165c20c13f2a898205ff72db31
parent2534ef94426f71e51fe4ad37f02afb86fa5e552b (diff)
downloademacs-fcaedd23eb5b8752cbd2083918c18a9436eee70a.tar.gz
emacs-fcaedd23eb5b8752cbd2083918c18a9436eee70a.zip
(Loading): Include new node "Load Suffixes" in menu.
(How Programs Do Loading): Discuss the effects of Auto Compression mode on `load'. (Load Suffixes): New node. (Library Search): Delete description of `load-suffixes': it was moved to "Load Suffixes". (Autoload, Named Features): Mention `load-suffixes'.
-rw-r--r--lispref/loading.texi96
1 files changed, 76 insertions, 20 deletions
diff --git a/lispref/loading.texi b/lispref/loading.texi
index b78fb92ad82..e12d44c71de 100644
--- a/lispref/loading.texi
+++ b/lispref/loading.texi
@@ -36,6 +36,7 @@ containing Lisp code.
36 36
37@menu 37@menu
38* How Programs Do Loading:: The @code{load} function and others. 38* How Programs Do Loading:: The @code{load} function and others.
39* Load Suffixes:: Details about the suffixes that @code{load} tries.
39* Library Search:: Finding a library to load. 40* Library Search:: Finding a library to load.
40* Loading Non-ASCII:: Non-@acronym{ASCII} characters in Emacs Lisp files. 41* Loading Non-ASCII:: Non-@acronym{ASCII} characters in Emacs Lisp files.
41* Autoload:: Setting up a function to autoload. 42* Autoload:: Setting up a function to autoload.
@@ -72,17 +73,27 @@ exists. (The @code{load} function is not clever about looking at
72@var{filename}. In the perverse case of a file named @file{foo.el.el}, 73@var{filename}. In the perverse case of a file named @file{foo.el.el},
73evaluation of @code{(load "foo.el")} will indeed find it.) 74evaluation of @code{(load "foo.el")} will indeed find it.)
74 75
75If the optional argument @var{nosuffix} is non-@code{nil}, then the 76If Auto Compression mode is enabled, as it is by default, then
76suffixes @samp{.elc} and @samp{.el} are not tried. In this case, you 77if @code{load} can not find a file, it searches for a compressed
77must specify the precise file name you want. By specifying the precise 78version of the file before trying other file names. It decompresses
78file name and using @code{t} for @var{nosuffix}, you can prevent 79and loads it if it exists. It looks for compressed versions by
79perverse file names such as @file{foo.el.el} from being tried. 80appending the suffixes in @code{jka-compr-load-suffixes} to the file
81name. The value of this variable must be a list of strings. Its
82standard value is @code{(".gz")}.
83
84If the optional argument @var{nosuffix} is non-@code{nil}, then
85@code{load} does not try the suffixes @samp{.elc} and @samp{.el}. In
86this case, you must specify the precise file name you want, except
87that, if Auto Compression mode is enabled, @code{load} will still use
88@code{jka-compr-load-suffixes} to find compressed versions. By
89specifying the precise file name and using @code{t} for
90@var{nosuffix}, you can prevent perverse file names such as
91@file{foo.el.el} from being tried.
80 92
81If the optional argument @var{must-suffix} is non-@code{nil}, then 93If the optional argument @var{must-suffix} is non-@code{nil}, then
82@code{load} insists that the file name used must end in either 94@code{load} insists that the file name used must end in either
83@samp{.el} or @samp{.elc}, unless it contains an explicit directory 95@samp{.el} or @samp{.elc} (possibly extended with a compression
84name. If @var{filename} does not contain an explicit directory name, 96suffix), unless it contains an explicit directory name.
85and does not end in a suffix, then @code{load} insists on adding one.
86 97
87If @var{filename} is a relative file name, such as @file{foo} or 98If @var{filename} is a relative file name, such as @file{foo} or
88@file{baz/foo.bar}, @code{load} searches for the file using the variable 99@file{baz/foo.bar}, @code{load} searches for the file using the variable
@@ -127,8 +138,10 @@ See below.
127@deffn Command load-file filename 138@deffn Command load-file filename
128This command loads the file @var{filename}. If @var{filename} is a 139This command loads the file @var{filename}. If @var{filename} is a
129relative file name, then the current default directory is assumed. 140relative file name, then the current default directory is assumed.
130@code{load-path} is not used, and suffixes are not appended. Use this 141This command does not use @code{load-path}, and does not append
131command if you wish to specify precisely the file name to load. 142suffixes. However, it does look for compressed versions (if Auto
143Compression Mode is enabled). Use this command if you wish to specify
144precisely the file name to load.
132@end deffn 145@end deffn
133 146
134@deffn Command load-library library 147@deffn Command load-library library
@@ -158,6 +171,53 @@ feature: to pass the function as the @var{read-function} argument to
158 For information about how @code{load} is used in building Emacs, see 171 For information about how @code{load} is used in building Emacs, see
159@ref{Building Emacs}. 172@ref{Building Emacs}.
160 173
174@node Load Suffixes
175@section Load Suffixes
176We now describe some technical details about the exact suffixes that
177@code{load} tries.
178
179@defvar load-suffixes
180This is a list of suffixes indicating (compiled or source) Emacs Lisp
181files. It should not include the empty string. @code{load} uses
182these suffixes in order when it appends Lisp suffixes to the specified
183file name. The standard value is @code{(".elc" "el")} which produces
184the behavior described in the previous section.
185@end defvar
186
187@defvar load-file-rep-suffixes
188This is a list of suffixes that indicate representations of the same
189file. This list should normally start with the empty string.
190When @code{load} searches for a file it appends the suffixes in this
191list, in order, to the file name, before searching for another file.
192
193Enabling Auto Compression mode appends the suffixes in
194@code{jka-compr-load-suffixes} to this list and disabling Auto
195Compression mode removes them again. The standard value of
196@code{load-file-rep-suffixes} if Auto Compression mode is disabled is
197@code{("")}. Given that the standard value of
198@code{jka-compr-load-suffixes} is @code{(".gz")}, the standard value
199of @code{load-file-rep-suffixes} if Auto Compression mode is enabled
200is @code{("" ".gz")}.
201@end defvar
202
203@defun get-load-suffixes
204This function returns the list of all suffixes that @code{load} should
205try, in order, when its @var{must-suffix} argument is non-@code{nil}.
206This takes both @code{load-suffixes} and @code{load-file-rep-suffixes}
207into account. If @code{load-suffixes}, @code{jka-compr-load-suffixes}
208and @code{load-file-rep-suffixes} all have their standard values, this
209function returns @code{(".elc" "elc.gz" ".el" ".el.gz")} if Auto
210Compression mode is enabled and @code{(".elc" ".el")} if Auto
211Compression mode is disabled.
212@end defun
213
214To summarize, if both its @var{nosuffix} and @var{must-suffix}
215arguments are @code{nil}, @code{load} first tries the suffixes in the
216return value of @code{get-load-suffixes} and then those in
217@code{load-file-rep-suffixes}. If @var{nosuffix} is non-@code{nil},
218it only tries the latter and is @var{must-suffix} is non-@code{nil},
219only the former.
220
161@node Library Search 221@node Library Search
162@section Library Search 222@section Library Search
163 223
@@ -288,13 +348,6 @@ interactively, the argument @var{interactive-call} is @code{t}, and this
288tells @code{locate-library} to display the file name in the echo area. 348tells @code{locate-library} to display the file name in the echo area.
289@end deffn 349@end deffn
290 350
291@defvar load-suffixes
292This variable is a list of suffixes (strings) that @code{load} should
293try adding to the specified file name. The default value is
294@code{(".elc" ".elc.gz" ".el" ".el.gz" ".gz")}. There is no need to
295include the null suffix.
296@end defvar
297
298@node Loading Non-ASCII 351@node Loading Non-ASCII
299@section Loading Non-@acronym{ASCII} Characters 352@section Loading Non-@acronym{ASCII} Characters
300 353
@@ -362,7 +415,8 @@ specifies the file to load to get the real definition of @var{function}.
362If @var{filename} does not contain either a directory name, or the 415If @var{filename} does not contain either a directory name, or the
363suffix @code{.el} or @code{.elc}, then @code{autoload} insists on adding 416suffix @code{.el} or @code{.elc}, then @code{autoload} insists on adding
364one of these suffixes, and it will not load from a file whose name is 417one of these suffixes, and it will not load from a file whose name is
365just @var{filename} with no added suffix. 418just @var{filename} with no added suffix. (The variable
419@code{load-suffixes} specifies the exact required suffixes.)
366 420
367The argument @var{docstring} is the documentation string for the 421The argument @var{docstring} is the documentation string for the
368function. Specifying the documentation string in the call to 422function. Specifying the documentation string in the call to
@@ -699,8 +753,10 @@ If the feature is not present, then @code{require} loads @var{filename}
699with @code{load}. If @var{filename} is not supplied, then the name of 753with @code{load}. If @var{filename} is not supplied, then the name of
700the symbol @var{feature} is used as the base file name to load. 754the symbol @var{feature} is used as the base file name to load.
701However, in this case, @code{require} insists on finding @var{feature} 755However, in this case, @code{require} insists on finding @var{feature}
702with an added suffix; a file whose name is just @var{feature} won't be 756with an added @samp{el} or @samp{.elc} suffix (possibly extended with
703used. 757a compression suffix); a file whose name is just @var{feature} won't
758be used. (The variable @code{load-suffixes} specifies the exact
759required Lisp suffixes.)
704 760
705If @var{noerror} is non-@code{nil}, that suppresses errors from actual 761If @var{noerror} is non-@code{nil}, that suppresses errors from actual
706loading of the file. In that case, @code{require} returns @code{nil} 762loading of the file. In that case, @code{require} returns @code{nil}