diff options
author | Richard M. Stallman <rms@gnu.org> | 1998-04-20 17:43:57 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1998-04-20 17:43:57 +0000 |
commit | 969fe9b5696c9d9d31f2faf1ca2e8af107013dcb (patch) | |
tree | 5d7d0399caf410b5c4849aa9d43352b18f68d4c9 /lispref/loading.texi | |
parent | b933f645ac70a31659f364cabf7da730d27eb244 (diff) | |
download | emacs-969fe9b5696c9d9d31f2faf1ca2e8af107013dcb.tar.gz |
*** empty log message ***
Diffstat (limited to 'lispref/loading.texi')
-rw-r--r-- | lispref/loading.texi | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/lispref/loading.texi b/lispref/loading.texi index e3a72b3e318..44eac1cbe44 100644 --- a/lispref/loading.texi +++ b/lispref/loading.texi @@ -88,6 +88,10 @@ If you get a warning that @file{foo.elc} is older than @file{foo.el}, it means you should consider recompiling @file{foo.el}. @xref{Byte Compilation}. +When loading a source file (not compiled), @code{load} performs +character set translation just as Emacs would do when visiting the file. +@xref{Coding Systems}. + Messages like @samp{Loading foo...} and @samp{Loading foo...done} appear in the echo area during loading unless @var{nomessage} is non-@code{nil}. @@ -170,13 +174,6 @@ followed then by the @file{/user/bil/emacs} directory, the @file{/usr/local/lisplib} directory, and the @file{~/emacs} directory, which are then followed by the standard directories for Lisp code. -The command line options @samp{-l} or @samp{-load} specify a Lisp -library to load as part of Emacs startup. Since this file might be in -the current directory, Emacs 18 temporarily adds the current directory -to the front of @code{load-path} so the file can be found there. Newer -Emacs versions also find such files in the current directory, but -without altering @code{load-path}. - Dumping Emacs uses a special value of @code{load-path}. If the value of @code{load-path} at the end of dumping is unchanged (that is, still the same special value), the dumped Emacs switches to the ordinary @@ -233,7 +230,7 @@ Normally, the variable's value is @code{nil}, which means those functions should use @code{read}. @end defvar - To learn how @code{load} is used to build Emacs, see @ref{Building Emacs}. + For how @code{load} is used to build Emacs, see @ref{Building Emacs}. @deffn Command locate-library library &optional nosuffix path interactive-call This command finds the precise file name for library @var{library}. It @@ -265,11 +262,11 @@ as if it had been loaded all along. @code{autoload}, and by writing a special ``magic'' comment in the source before the real definition. @code{autoload} is the low-level primitive for autoloading; any Lisp program can call @code{autoload} at -any time. Magic comments do nothing on their own; they serve as a guide -for the command @code{update-file-autoloads}, which constructs calls to -@code{autoload} and arranges to execute them when Emacs is built. Magic -comments are the most convenient way to make a function autoload, but -only for packages installed along with Emacs. +any time. Magic comments are the most convenient way to make a function +autoload, for packages installed along with Emacs. They do nothing on +their own, but they serve as a guide for the command +@code{update-file-autoloads}, which constructs calls to @code{autoload} +and arranges to execute them when Emacs is built. @defun autoload function filename &optional docstring interactive type This function defines the function (or macro) named @var{function} so as @@ -287,10 +284,10 @@ in the function definition itself. Specifying the documentation string in the call to @code{autoload} makes it possible to look at the documentation without loading the function's real definition. -If @var{interactive} is non-@code{nil}, then the function can be called -interactively. This lets completion in @kbd{M-x} work without loading -the function's real definition. The complete interactive specification -is not given here; it's not needed unless the user actually calls +If @var{interactive} is non-@code{nil}, that says @var{function} can be +called interactively. This lets completion in @kbd{M-x} work without +loading its real definition. The complete interactive specification is +not given here; it's not needed unless the user actually calls @var{function}, and when that happens, it's time to load the real definition. @@ -365,8 +362,9 @@ function definition, it is copied verbatim. You can also use a magic comment to execute a form at build time @emph{without} executing it when the file itself is loaded. To do this, write the form @emph{on the same line} as the magic comment. Since it is in a comment, it does nothing -when you load the source file; but @code{update-file-autoloads} copies -it to @file{loaddefs.el}, where it is executed while building Emacs. +when you load the source file; but @kbd{M-x update-file-autoloads} +copies it to @file{loaddefs.el}, where it is executed while building +Emacs. The following example shows how @code{doctor} is prepared for autoloading with a magic comment: @@ -400,7 +398,7 @@ documentation string in the @file{etc/DOC} file. @xref{Building Emacs}. @section Repeated Loading @cindex repeated loading - You may load one file more than once in an Emacs session. For + You can load one file more than once in an Emacs session. For example, after you have rewritten and reinstalled a function definition by editing it in a buffer, you may wish to return to the original version; you can do this by reloading the file it came from. @@ -411,8 +409,8 @@ rather than a non-compiled file of similar name. If you rewrite a file that you intend to save and reinstall, you need to byte-compile the new version; otherwise Emacs will load the older, byte-compiled file instead of your newer, non-compiled file! If that happens, the message -displayed when loading the file says, ``(compiled; source is newer'', to -remind you to recompile. +displayed when loading the file includes, @samp{(compiled; source is +newer)}, to remind you to recompile it. When writing the forms in a Lisp library file, keep in mind that the file might be loaded more than once. For example, think about whether @@ -445,17 +443,17 @@ already been loaded. Here's one way to test, in a library, whether it has been loaded before: @example -(defvar foo-was-loaded) +(defvar foo-was-loaded nil) -(if (not (boundp 'foo-was-loaded)) - @var{execute-first-time-only}) - -(setq foo-was-loaded t) +(unless foo-was-loaded + @var{execute-first-time-only} + (setq foo-was-loaded t)) @end example @noindent If the library uses @code{provide} to provide a named feature, you can -use @code{featurep} to test whether the library has been loaded. +use @code{featurep} earlier in the file to test whether the +@code{provide} call has been executed before. @ifinfo @xref{Named Features}. @end ifinfo @@ -486,9 +484,6 @@ file should call @code{provide} at the top level to add the feature to @code{features}; if it fails to do so, @code{require} signals an error. @cindex load error with require - Features are normally named after the files that provide them, so that -@code{require} need not be given the file name. - For example, in @file{emacs/lisp/prolog.el}, the definition for @code{run-prolog} includes the following code: @@ -504,7 +499,8 @@ the definition for @code{run-prolog} includes the following code: @noindent The expression @code{(require 'comint)} loads the file @file{comint.el} if it has not yet been loaded. This ensures that @code{make-comint} is -defined. +defined. Features are normally named after the files that provide them, +so that @code{require} need not be given the file name. The @file{comint.el} file contains the following top-level expression: @@ -541,7 +537,7 @@ feature, as in the following example. The compiler ignores the @code{provide}, then processes the @code{require} by loading the file in question. Loading the file does execute the @code{provide} call, so the subsequent @code{require} call -does nothing while loading. +does nothing when the file is loaded. @defun provide feature This function announces that @var{feature} is now loaded, or being @@ -589,7 +585,7 @@ provided}. @defun featurep feature This function returns @code{t} if @var{feature} has been provided in the -current Emacs session (i.e., @var{feature} is a member of +current Emacs session (i.e., if @var{feature} is a member of @code{features}.) @end defun @@ -612,10 +608,10 @@ reclaim memory for other Lisp objects. To do this, use the function @deffn Command unload-feature feature &optional force This command unloads the library that provided feature @var{feature}. It undefines all functions, macros, and variables defined in that -library with @code{defconst}, @code{defvar}, @code{defun}, -@code{defmacro}, @code{defsubst} and @code{defalias}. It then restores -any autoloads formerly associated with those symbols. (Loading -saves these in the @code{autoload} property of the symbol.) +library with @code{defun}, @code{defalias}, @code{defsubst}, +@code{defmacro}, @code{defconst}, @code{defvar}, and @code{defcustom}. +It then restores any autoloads formerly associated with those symbols. +(Loading saves these in the @code{autoload} property of the symbol.) Ordinarily, @code{unload-feature} refuses to unload a library on which other loaded libraries depend. (A library @var{a} depends on library @@ -686,9 +682,9 @@ do (1), you can do it immediately---there is no need to wait for when the library is loaded. To do (2), you must load the library (preferably with @code{require}). -But it is ok to use @code{eval-after-load} in your personal customizations -if you don't feel they must meet the design standards of programs to be -released. +But it is OK to use @code{eval-after-load} in your personal +customizations if you don't feel they must meet the design standards for +programs meant for wider use. @defvar after-load-alist An alist of expressions to evaluate if and when particular libraries are |