comparison lispref/loading.texi @ 45979:87962bf716e3

*** empty log message ***
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 23 Jun 2002 22:15:43 +0000
parents c3e528c6c110
children 8a11d295c3f3
comparison
equal deleted inserted replaced
45978:a8fbafaa31ad 45979:87962bf716e3
635 The compiler ignores the @code{provide}, then processes the 635 The compiler ignores the @code{provide}, then processes the
636 @code{require} by loading the file in question. Loading the file does 636 @code{require} by loading the file in question. Loading the file does
637 execute the @code{provide} call, so the subsequent @code{require} call 637 execute the @code{provide} call, so the subsequent @code{require} call
638 does nothing when the file is loaded. 638 does nothing when the file is loaded.
639 639
640 @defun provide feature 640 @defun provide feature &optional subfeatures
641 This function announces that @var{feature} is now loaded, or being 641 This function announces that @var{feature} is now loaded, or being
642 loaded, into the current Emacs session. This means that the facilities 642 loaded, into the current Emacs session. This means that the facilities
643 associated with @var{feature} are or will be available for other Lisp 643 associated with @var{feature} are or will be available for other Lisp
644 programs. 644 programs.
645 645
646 The direct effect of calling @code{provide} is to add @var{feature} to 646 The direct effect of calling @code{provide} is to add @var{feature} to
647 the front of the list @code{features} if it is not already in the list. 647 the front of the list @code{features} if it is not already in the list.
648 The argument @var{feature} must be a symbol. @code{provide} returns 648 The argument @var{feature} must be a symbol. @code{provide} returns
649 @var{feature}. 649 @var{feature}.
650
651 If provided, @var{subfeatures} should be a list of symbols indicating
652 a set of specific subfeatures provided by this version of @var{feature}.
650 653
651 @smallexample 654 @smallexample
652 features 655 features
653 @result{} (bar bish) 656 @result{} (bar bish)
654 657
679 If loading the file fails to provide @var{feature}, @code{require} 682 If loading the file fails to provide @var{feature}, @code{require}
680 signals an error, @samp{Required feature @var{feature} was not 683 signals an error, @samp{Required feature @var{feature} was not
681 provided}, unless @var{noerror} is non-@code{nil}. 684 provided}, unless @var{noerror} is non-@code{nil}.
682 @end defun 685 @end defun
683 686
684 @defun featurep feature 687 @defun featurep feature &optional subfeature
685 This function returns @code{t} if @var{feature} has been provided in the 688 This function returns @code{t} if @var{feature} has been provided in the
686 current Emacs session (i.e., if @var{feature} is a member of 689 current Emacs session (i.e., if @var{feature} is a member of
687 @code{features}.) 690 @code{features}.) If @var{subfeature} is non-nil, then the function
691 returns @code{t} only if that subfeature is provided as well (i.e.
692 if @var{subfeature} is a member of the @var{subfeature} property
693 of the @var{feature} symbol.)
688 @end defun 694 @end defun
689 695
690 @defvar features 696 @defvar features
691 The value of this variable is a list of symbols that are the features 697 The value of this variable is a list of symbols that are the features
692 loaded in the current Emacs session. Each symbol was put in this list 698 loaded in the current Emacs session. Each symbol was put in this list
794 @defun eval-after-load library form 800 @defun eval-after-load library form
795 This function arranges to evaluate @var{form} at the end of loading the 801 This function arranges to evaluate @var{form} at the end of loading the
796 library @var{library}, if and when @var{library} is loaded. If 802 library @var{library}, if and when @var{library} is loaded. If
797 @var{library} is already loaded, it evaluates @var{form} right away. 803 @var{library} is already loaded, it evaluates @var{form} right away.
798 804
799 The library name @var{library} must exactly match the argument of 805 If @var{library} is a string, it must exactly match the argument of
800 @code{load}. To get the proper results when an installed library is 806 @code{load} used to load the library. To get the proper results when an
801 found by searching @code{load-path}, you should not include any 807 installed library is found by searching @code{load-path}, you should not
802 directory names in @var{library}. 808 include any directory names in @var{library}.
809
810 @var{library} can also be a feature (i.e. a symbol), in which case,
811 @var{form} is evaluated when @code{(provide @var{library})} is called.
803 812
804 An error in @var{form} does not undo the load, but does prevent 813 An error in @var{form} does not undo the load, but does prevent
805 execution of the rest of @var{form}. 814 execution of the rest of @var{form}.
806 @end defun 815 @end defun
807 816