diff options
| author | Richard M. Stallman | 2004-12-27 16:52:33 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-12-27 16:52:33 +0000 |
| commit | 82c59a6b1cf57c9facaa0c726560898da01ae216 (patch) | |
| tree | 2e895736cf5166292a0919e2c5e87fb219f4e513 | |
| parent | 5d8d3a34e511f31561f031abc804645e6eb7dcd7 (diff) | |
| download | emacs-82c59a6b1cf57c9facaa0c726560898da01ae216.tar.gz emacs-82c59a6b1cf57c9facaa0c726560898da01ae216.zip | |
(Where Defined): New node.
(Unloading): load-history moved to Where Defined.
| -rw-r--r-- | lispref/loading.texi | 91 |
1 files changed, 55 insertions, 36 deletions
diff --git a/lispref/loading.texi b/lispref/loading.texi index 1b90ef5f2dd..183e706ddb4 100644 --- a/lispref/loading.texi +++ b/lispref/loading.texi | |||
| @@ -42,6 +42,7 @@ containing Lisp code. | |||
| 42 | * Autoload:: Setting up a function to autoload. | 42 | * Autoload:: Setting up a function to autoload. |
| 43 | * Repeated Loading:: Precautions about loading a file twice. | 43 | * Repeated Loading:: Precautions about loading a file twice. |
| 44 | * Named Features:: Loading a library if it isn't already loaded. | 44 | * Named Features:: Loading a library if it isn't already loaded. |
| 45 | * Where Defined:: Finding which file defined a certain symbol. | ||
| 45 | * Unloading:: How to ``unload'' a library that was loaded. | 46 | * Unloading:: How to ``unload'' a library that was loaded. |
| 46 | * Hooks for Loading:: Providing code to be run when | 47 | * Hooks for Loading:: Providing code to be run when |
| 47 | particular libraries are loaded. | 48 | particular libraries are loaded. |
| @@ -714,6 +715,60 @@ with a call to @code{provide}. The order of the elements in the | |||
| 714 | @code{features} list is not significant. | 715 | @code{features} list is not significant. |
| 715 | @end defvar | 716 | @end defvar |
| 716 | 717 | ||
| 718 | @node Where Defined | ||
| 719 | @section Which File Defined a Certain Symbol | ||
| 720 | |||
| 721 | @defun symbol-file symbol &optional type | ||
| 722 | This function returns the name of the file that defined @var{symbol}. | ||
| 723 | If @var{type} is @code{nil}, then any kind of definition is | ||
| 724 | acceptable. If @var{type} is @code{defun} or @code{defvar}, that | ||
| 725 | specifies function definition only or variable definition only. | ||
| 726 | |||
| 727 | The value is the file name as it was specified to @code{load}: | ||
| 728 | either an absolute file name, or a library name | ||
| 729 | (with no directory name and no @samp{.el} or @samp{.elc} at the end). | ||
| 730 | It can also be @code{nil}, if the definition is not associated with any file. | ||
| 731 | @end defun | ||
| 732 | |||
| 733 | The basis for @code{symbol-file} is the data in the variable | ||
| 734 | @code{load-history}. | ||
| 735 | |||
| 736 | @defvar load-history | ||
| 737 | This variable's value is an alist connecting library names with the | ||
| 738 | names of functions and variables they define, the features they provide, | ||
| 739 | and the features they require. | ||
| 740 | |||
| 741 | Each element is a list and describes one library. The @sc{car} of the | ||
| 742 | list is the name of the library, as a string. The rest of the list | ||
| 743 | elements have these forms: | ||
| 744 | |||
| 745 | @table @code | ||
| 746 | @item @var{var} | ||
| 747 | The symbol @var{var} was defined as a variable. | ||
| 748 | @item (defun . @var{fun}) | ||
| 749 | The @var{fun} was defined by this library. | ||
| 750 | @item (t . @var{fun}) | ||
| 751 | The function @var{fun} was previously an autoload before this library | ||
| 752 | redefined it as a function. The following element is always the | ||
| 753 | symbol @var{fun}, which signifies that the library defined @var{fun} | ||
| 754 | as a function. | ||
| 755 | @item (autoload . @var{fun}) | ||
| 756 | The function @var{fun} was defined as an autoload. | ||
| 757 | @item (require . @var{feature}) | ||
| 758 | The feature @var{feature} was required. | ||
| 759 | @item (provide . @var{feature}) | ||
| 760 | The feature @var{feature} was provided. | ||
| 761 | @end table | ||
| 762 | |||
| 763 | The value of @code{load-history} may have one element whose @sc{car} is | ||
| 764 | @code{nil}. This element describes definitions made with | ||
| 765 | @code{eval-buffer} on a buffer that is not visiting a file. | ||
| 766 | @end defvar | ||
| 767 | |||
| 768 | The command @code{eval-region} updates @code{load-history}, but does so | ||
| 769 | by adding the symbols defined to the element for the file being visited, | ||
| 770 | rather than replacing that element. @xref{Eval}. | ||
| 771 | |||
| 717 | @node Unloading | 772 | @node Unloading |
| 718 | @section Unloading | 773 | @section Unloading |
| 719 | @cindex unloading | 774 | @cindex unloading |
| @@ -760,42 +815,6 @@ ignored and you can unload any library. | |||
| 760 | The @code{unload-feature} function is written in Lisp; its actions are | 815 | The @code{unload-feature} function is written in Lisp; its actions are |
| 761 | based on the variable @code{load-history}. | 816 | based on the variable @code{load-history}. |
| 762 | 817 | ||
| 763 | @defvar load-history | ||
| 764 | This variable's value is an alist connecting library names with the | ||
| 765 | names of functions and variables they define, the features they provide, | ||
| 766 | and the features they require. | ||
| 767 | |||
| 768 | Each element is a list and describes one library. The @sc{car} of the | ||
| 769 | list is the name of the library, as a string. The rest of the list | ||
| 770 | elements have these forms: | ||
| 771 | |||
| 772 | @table @code | ||
| 773 | @item @var{fun} | ||
| 774 | The function @var{fun} was defined by this library. | ||
| 775 | @item (t . @var{fun}) | ||
| 776 | The function @var{fun} was previously an autoload before this library | ||
| 777 | redefined it as a function. The following element is always the | ||
| 778 | symbol @var{fun}, which signifies that the library defined @var{fun} | ||
| 779 | as a function. | ||
| 780 | @item (autoload . @var{fun}) | ||
| 781 | The function @var{fun} was defined as an autoload. | ||
| 782 | @item (defvar . @var{var}) | ||
| 783 | The symbol @var{var} was defined as a variable. | ||
| 784 | @item (require . @var{feature}) | ||
| 785 | The feature @var{feature} was required. | ||
| 786 | @item (provide . @var{feature}) | ||
| 787 | The feature @var{feature} was provided. | ||
| 788 | @end table | ||
| 789 | |||
| 790 | The value of @code{load-history} may have one element whose @sc{car} is | ||
| 791 | @code{nil}. This element describes definitions made with | ||
| 792 | @code{eval-buffer} on a buffer that is not visiting a file. | ||
| 793 | @end defvar | ||
| 794 | |||
| 795 | The command @code{eval-region} updates @code{load-history}, but does so | ||
| 796 | by adding the symbols defined to the element for the file being visited, | ||
| 797 | rather than replacing that element. @xref{Eval}. | ||
| 798 | |||
| 799 | @defvar unload-feature-special-hooks | 818 | @defvar unload-feature-special-hooks |
| 800 | This variable holds a list of hooks to be scanned before unloading a | 819 | This variable holds a list of hooks to be scanned before unloading a |
| 801 | library, to remove functions defined in the library. | 820 | library, to remove functions defined in the library. |