]> code.delx.au - gnu-emacs/blobdiff - lispref/loading.texi
(regexp-opt-group): Compute HALF2 properly.
[gnu-emacs] / lispref / loading.texi
index c53edbe77ec592fd07f992caa5433a9491a49ac9..0292088447cf6465648318527af751b64ec39bc2 100644 (file)
@@ -322,7 +322,8 @@ this does make a difference, you can force a particular Lisp file to be
 interpreted as unibyte by writing @samp{-*-unibyte: t;-*-} in a
 comment on the file's first line.  With that designator, the file will
 unconditionally be interpreted as unibyte, even in an ordinary
-multibyte Emacs session.
+multibyte Emacs session.  This can matter when making keybindings to
+non-@sc{ascii} characters written as @code{?v@var{literal}}.
 
 @node Autoload
 @section Autoload
@@ -477,6 +478,18 @@ convention used only in the preloaded uncompiled Lisp files such as
 documentation string in the @file{etc/DOC} file.  @xref{Building Emacs}.
 See also the commentary in @file{lib-src/make-docfile.c}.
 
+  If you write a function definition with an unusual macro that is not
+one of the known and recognized function definition methods, use of an
+ordinary magic autoload comment would copy the whole definition into
+@code{loaddefs.el}.  That is not desirable.  You can put the desired
+@code{autoload} call into @code{loaddefs.el} instead by writing this:
+
+@smallexample
+;;;###autoload (autoload 'foo "myfile")
+(mydefunmacro foo
+  ...)
+@end smallexample
+
 @node Repeated Loading
 @section Repeated Loading
 @cindex repeated loading
@@ -624,7 +637,7 @@ The compiler ignores the @code{provide}, then processes the
 execute the @code{provide} call, so the subsequent @code{require} call
 does nothing when the file is loaded.
 
-@defun provide feature
+@defun provide feature &optional subfeatures
 This function announces that @var{feature} is now loaded, or being
 loaded, into the current Emacs session.  This means that the facilities
 associated with @var{feature} are or will be available for other Lisp
@@ -635,6 +648,9 @@ the front of the list @code{features} if it is not already in the list.
 The argument @var{feature} must be a symbol.  @code{provide} returns
 @var{feature}.
 
+If provided, @var{subfeatures} should be a list of symbols indicating
+a set of specific subfeatures provided by this version of @var{feature}.
+
 @smallexample
 features
      @result{} (bar bish)
@@ -668,10 +684,13 @@ signals an error, @samp{Required feature @var{feature} was not
 provided}, unless @var{noerror} is non-@code{nil}.
 @end defun
 
-@defun featurep feature
+@defun featurep feature &optional subfeature
 This function returns @code{t} if @var{feature} has been provided in the
-current Emacs session (i.e., if @var{feature} is a member of
-@code{features}.)
+current Emacs session (i.e.@:, if @var{feature} is a member of
+@code{features}.)  If @var{subfeature} is non-nil, then the function
+returns @code{t} only if that subfeature is provided as well (i.e.@:
+if @var{subfeature} is a member of the @code{subfeature} property
+of the @var{feature} symbol.)
 @end defun
 
 @defvar features
@@ -731,19 +750,26 @@ names of functions and variables they define, the features they provide,
 and the features they require.
 
 Each element is a list and describes one library.  The @sc{car} of the
-list is the name of the library, as a string.  The rest of the list is
-composed of these kinds of objects:
-
-@itemize @bullet
-@item
-Symbols that were defined by this library.
-@item
-Lists of the form @code{(require . @var{feature})} indicating
-features that were required.
-@item
-Lists of the form @code{(provide . @var{feature})} indicating
-features that were provided.
-@end itemize
+list is the name of the library, as a string.  The rest of the list
+elements have these forms:
+
+@table @code
+@item @var{fun}
+The function @var{fun} was defined by this library.
+@item (t . @var{fun})
+The function @var{fun} was previously an autoload before this library
+redefined it as a function.  The following element is always the
+symbol @var{fun}, which signifies that the library defined @var{fun}
+as a function.
+@item (autoload . @var{fun})
+The function @var{fun} was defined as an autoload.
+@item (defvar . @var{var})
+The symbol @var{var} was defined as a variable.
+@item (require . @var{feature})
+The feature @var{feature} was required.
+@item (provide . @var{feature})
+The feature @var{feature} was provided.
+@end table
 
 The value of @code{load-history} may have one element whose @sc{car} is
 @code{nil}.  This element describes definitions made with
@@ -783,10 +809,13 @@ This function arranges to evaluate @var{form} at the end of loading the
 library @var{library}, if and when @var{library} is loaded.  If
 @var{library} is already loaded, it evaluates @var{form} right away.
 
-The library name @var{library} must exactly match the argument of
-@code{load}.  To get the proper results when an installed library is
-found by searching @code{load-path}, you should not include any
-directory names in @var{library}.
+If @var{library} is a string, it must exactly match the argument of
+@code{load} used to load the library.  To get the proper results when an
+installed library is found by searching @code{load-path}, you should not
+include any directory names in @var{library}.
+
+@var{library} can also be a feature (i.e.@: a symbol), in which case
+@var{form} is evaluated when @code{(provide @var{library})} is called.
 
 An error in @var{form} does not undo the load, but does prevent
 execution of the rest of @var{form}.