[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/doc/lispref loading.texi
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] emacs/doc/lispref loading.texi |
Date: |
Thu, 12 Mar 2009 01:06:53 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Chong Yidong <cyd> 09/03/12 01:06:53
Modified files:
doc/lispref : loading.texi
Log message:
(Repeated Loading): Simplify examples.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/doc/lispref/loading.texi?cvsroot=emacs&r1=1.9&r2=1.10
Patches:
Index: loading.texi
===================================================================
RCS file: /sources/emacs/emacs/doc/lispref/loading.texi,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- loading.texi 8 Jan 2009 05:29:00 -0000 1.9
+++ loading.texi 12 Mar 2009 01:06:53 -0000 1.10
@@ -621,24 +621,18 @@
@end example
@noindent
-But this would add multiple elements if the library is reloaded.
-To avoid the problem, write this:
-
address@hidden
-(or (assq 'leif-mode minor-mode-alist)
- (push '(leif-mode " Leif") minor-mode-alist))
address@hidden example
-
address@hidden
-or this:
+But this would add multiple elements if the library is reloaded. To
+avoid the problem, use @code{add-to-list} (@pxref{List Variables}):
@example
(add-to-list '(leif-mode " Leif") minor-mode-alist)
@end example
Occasionally you will want to test explicitly whether a library has
-already been loaded. Here's one way to test, in a library, whether it
-has been loaded before:
+already been loaded. If the library uses @code{provide} to provide a
+named feature, you can use @code{featurep} earlier in the file to test
+whether the @code{provide} call has been executed before (@pxref{Named
+Features}). Alternatively, you could use something like this:
@example
(defvar foo-was-loaded nil)
@@ -649,12 +643,6 @@
@end example
@noindent
-If the library uses @code{provide} to provide a named feature, you can
-use @code{featurep} earlier in the file to test whether the
address@hidden call has been executed before.
address@hidden
address@hidden Features}.
address@hidden ifnottex
@node Named Features
@section Features
@@ -674,13 +662,13 @@
@dfn{requiring} the feature. This loads the file of definitions if it
hasn't been loaded already.
address@hidden load error with require
To require the presence of a feature, call @code{require} with the
feature name as argument. @code{require} looks in the global variable
@code{features} to see whether the desired feature has been provided
already. If not, it loads the feature from the appropriate file. This
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.
address@hidden load error with require
For example, in @file{emacs/lisp/prolog.el},
the definition for @code{run-prolog} includes the following code:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/doc/lispref loading.texi,
Chong Yidong <=