diff options
| author | Kenichi Handa | 2010-08-26 09:28:08 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-08-26 09:28:08 +0900 |
| commit | 41a5c5c417bf605499fdfa16d96cd93fa4fca6a5 (patch) | |
| tree | 4db011ef79d5bc409a1be4c02c8a4a1eda037f59 | |
| parent | 2c94aa8db66ef9aa07b824b8cf1f88ce5164832d (diff) | |
| parent | fdc76236a9e16df0028a3ab706db6dd0eae8293b (diff) | |
| download | emacs-41a5c5c417bf605499fdfa16d96cd93fa4fca6a5.tar.gz emacs-41a5c5c417bf605499fdfa16d96cd93fa4fca6a5.zip | |
merge trunk
| -rw-r--r-- | doc/lispref/ChangeLog | 11 | ||||
| -rw-r--r-- | doc/lispref/anti.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 10 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/package.texi | 197 | ||||
| -rw-r--r-- | doc/lispref/tips.texi | 25 | ||||
| -rw-r--r-- | doc/lispref/vol1.texi | 8 | ||||
| -rw-r--r-- | doc/lispref/vol2.texi | 8 |
8 files changed, 261 insertions, 2 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index b58ce8cd464..65ad13b18ac 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2010-08-25 Tom Tromey <tromey@redhat.com> | ||
| 2 | |||
| 3 | * vol2.texi (Top): Update. | ||
| 4 | * vol1.texi (Top): Update. | ||
| 5 | * tips.texi (Library Headers): Mention Package-Version and | ||
| 6 | Package-Requires. | ||
| 7 | * package.texi: New file. | ||
| 8 | * os.texi (System Interface): Update pointers. | ||
| 9 | * elisp.texi (Top): Link to new nodes. Include package.texi. | ||
| 10 | * anti.texi (Antinews): Update pointers. | ||
| 11 | |||
| 1 | 2010-08-25 Eli Zaretskii <eliz@gnu.org> | 12 | 2010-08-25 Eli Zaretskii <eliz@gnu.org> |
| 2 | 13 | ||
| 3 | * processes.texi (Filter Functions): Fix last change. | 14 | * processes.texi (Filter Functions): Fix last change. |
diff --git a/doc/lispref/anti.texi b/doc/lispref/anti.texi index 11b8220d290..92e0432b842 100644 --- a/doc/lispref/anti.texi +++ b/doc/lispref/anti.texi | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | @c This node must have no pointers. | 7 | @c This node must have no pointers. |
| 8 | 8 | ||
| 9 | @node Antinews, GNU Free Documentation License, System Interface, Top | 9 | @node Antinews, GNU Free Documentation License, Packaging, Top |
| 10 | @appendix Emacs 22 Antinews | 10 | @appendix Emacs 22 Antinews |
| 11 | @c Update the elisp.texi, vol1.texi, vol2.texi Antinews menu entries | 11 | @c Update the elisp.texi, vol1.texi, vol2.texi Antinews menu entries |
| 12 | @c with the above version number. | 12 | @c with the above version number. |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 4c5471cf169..135bd17ac8d 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -159,6 +159,8 @@ Cover art by Etienne Suvasa. | |||
| 159 | * System Interface:: Getting the user id, system type, environment | 159 | * System Interface:: Getting the user id, system type, environment |
| 160 | variables, and other such things. | 160 | variables, and other such things. |
| 161 | 161 | ||
| 162 | * Packaging:: Preparing Lisp code for distribution. | ||
| 163 | |||
| 162 | Appendices | 164 | Appendices |
| 163 | 165 | ||
| 164 | * Antinews:: Info for users downgrading to Emacs 22. | 166 | * Antinews:: Info for users downgrading to Emacs 22. |
| @@ -1394,6 +1396,12 @@ Operating System Interface | |||
| 1394 | * Session Management:: Saving and restoring state with | 1396 | * Session Management:: Saving and restoring state with |
| 1395 | X Session Management. | 1397 | X Session Management. |
| 1396 | 1398 | ||
| 1399 | Preparing Lisp code for distribution | ||
| 1400 | |||
| 1401 | * Packaging Basics:: The basic concepts of Emacs Lisp packages. | ||
| 1402 | * Simple Packages:: How to package a single .el file. | ||
| 1403 | * Multi-file Packages:: How to package multiple files. | ||
| 1404 | |||
| 1397 | Starting Up Emacs | 1405 | Starting Up Emacs |
| 1398 | 1406 | ||
| 1399 | * Startup Summary:: Sequence of actions Emacs performs at startup. | 1407 | * Startup Summary:: Sequence of actions Emacs performs at startup. |
| @@ -1490,6 +1498,8 @@ Object Internals | |||
| 1490 | @include display.texi | 1498 | @include display.texi |
| 1491 | @include os.texi | 1499 | @include os.texi |
| 1492 | 1500 | ||
| 1501 | @include package.texi | ||
| 1502 | |||
| 1493 | @c MOVE to Emacs Manual: include misc-modes.texi | 1503 | @c MOVE to Emacs Manual: include misc-modes.texi |
| 1494 | 1504 | ||
| 1495 | @c appendices | 1505 | @c appendices |
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 4f37eb10b7a..dd827234272 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | @c Free Software Foundation, Inc. | 5 | @c Free Software Foundation, Inc. |
| 6 | @c See the file elisp.texi for copying conditions. | 6 | @c See the file elisp.texi for copying conditions. |
| 7 | @setfilename ../../info/os | 7 | @setfilename ../../info/os |
| 8 | @node System Interface, Antinews, Display, Top | 8 | @node System Interface, Packaging, Display, Top |
| 9 | @chapter Operating System Interface | 9 | @chapter Operating System Interface |
| 10 | 10 | ||
| 11 | This chapter is about starting and getting out of Emacs, access to | 11 | This chapter is about starting and getting out of Emacs, access to |
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi new file mode 100644 index 00000000000..138f8d934e6 --- /dev/null +++ b/doc/lispref/package.texi | |||
| @@ -0,0 +1,197 @@ | |||
| 1 | @c -*-texinfo-*- | ||
| 2 | @c This is part of the GNU Emacs Lisp Reference Manual. | ||
| 3 | @c Copyright (C) 2010 | ||
| 4 | @c Free Software Foundation, Inc. | ||
| 5 | @c See the file elisp.texi for copying conditions. | ||
| 6 | @setfilename ../../info/package | ||
| 7 | @node Packaging, Antinews, System Interface, Top | ||
| 8 | @chapter Preparing Lisp code for distribution | ||
| 9 | @cindex packaging | ||
| 10 | |||
| 11 | Emacs provides a standard way for Emacs Lisp code to be distributed | ||
| 12 | to users. This approach lets users easily download, install, | ||
| 13 | uninstall, and upgrade Lisp code that they might want to use. | ||
| 14 | |||
| 15 | A @dfn{package} is simply one or more files, formatted and bundled | ||
| 16 | in a particular way. Typically a package includes primarily Emacs | ||
| 17 | Lisp code, but it is possible to create other kinds of packages as | ||
| 18 | well. | ||
| 19 | |||
| 20 | @menu | ||
| 21 | * Packaging Basics:: The basic concepts of Emacs Lisp packages. | ||
| 22 | * Simple Packages:: How to package a single .el file. | ||
| 23 | * Multi-file Packages:: How to package multiple files. | ||
| 24 | @end menu | ||
| 25 | |||
| 26 | @node Packaging Basics | ||
| 27 | @section Packaging Basics | ||
| 28 | @cindex packaging basics | ||
| 29 | |||
| 30 | A package has a few attributes: | ||
| 31 | @cindex package attributes | ||
| 32 | |||
| 33 | @table @asis | ||
| 34 | @item Name | ||
| 35 | A string, the name of the package. This attribute is mandatory. If | ||
| 36 | it does not exist, the package cannot be installed by the package | ||
| 37 | manager. | ||
| 38 | |||
| 39 | @item Version | ||
| 40 | A version number, which is anything that can be parsed by | ||
| 41 | @code{version-to-list}. This attribute is mandatory. If it does not | ||
| 42 | exist, the package cannot be installed by the package manager. | ||
| 43 | |||
| 44 | @item Brief description | ||
| 45 | This is shown to the user in the package menu buffer. It is just a | ||
| 46 | single line. On a terminal with 80 characters per line, there are | ||
| 47 | only 36 characters available in the package menu mode for showing the | ||
| 48 | brief description, so it is best to keep it very brief. If no brief | ||
| 49 | name is given, an empty string is used. | ||
| 50 | |||
| 51 | @item Long description | ||
| 52 | This can be a @file{README} file or the like. This is available to | ||
| 53 | the user before the package is installed, via the package menu. It | ||
| 54 | should more fully describe the package and its capabilities, so a user | ||
| 55 | can read it to decide whether he wants to install the package. This | ||
| 56 | attribute is optional. | ||
| 57 | |||
| 58 | @item Dependencies | ||
| 59 | This is a list of other packages and their minimal acceptable | ||
| 60 | versions. This is used both at download time (to make sure all the | ||
| 61 | needed code is available) and at activation time (to ensure a package | ||
| 62 | is only activated if all its dependencies have been successfully | ||
| 63 | activated). This attribute is optional. | ||
| 64 | |||
| 65 | @item Manual | ||
| 66 | A package can optionally include an Info manual. | ||
| 67 | @end table | ||
| 68 | |||
| 69 | Conceptually, a package goes through several state transitions (in | ||
| 70 | reality some of these transitions are grouped together): | ||
| 71 | |||
| 72 | @table @asis | ||
| 73 | @item Download | ||
| 74 | Fetch the package from somewhere. | ||
| 75 | |||
| 76 | @item Install | ||
| 77 | Unpack the package, or write a @file{.el} file into the appropriate | ||
| 78 | install directory. This step also includes extracting autoloads and | ||
| 79 | byte-compiling the Emacs Lisp code. | ||
| 80 | |||
| 81 | @item Activate | ||
| 82 | Update @code{load-path} and @code{Info-directory-list} and evaluate | ||
| 83 | the autoloads, so that the package is ready for the user to use. | ||
| 84 | @end table | ||
| 85 | |||
| 86 | It is best for users if packages do not do too much work at | ||
| 87 | activation time. The best approach is to have activation consist of | ||
| 88 | some autoloads and little more. | ||
| 89 | |||
| 90 | @node Simple Packages | ||
| 91 | @section Simple Packages | ||
| 92 | @cindex single file packages | ||
| 93 | |||
| 94 | The simplest package consists of a single Emacs Lisp source file. | ||
| 95 | In this case, all the attributes of the package (@pxref{Packaging | ||
| 96 | Basics}) are taken from this file. | ||
| 97 | |||
| 98 | The package system expects this @file{.el} file to conform to the | ||
| 99 | Emacs Lisp library header conventions. @xref{Library Headers}. | ||
| 100 | |||
| 101 | The name of the package is the same as the base name of the | ||
| 102 | @file{.el} file, as written in the first comment line. For example, | ||
| 103 | given the header line: | ||
| 104 | |||
| 105 | @smallexample | ||
| 106 | ;;; superfrobnicator.el --- frobnicate and bifurcate flanges | ||
| 107 | @end smallexample | ||
| 108 | |||
| 109 | the package name will be @samp{superfrobnicator}. | ||
| 110 | |||
| 111 | The short description of the package is also taken from the first | ||
| 112 | line of the file. | ||
| 113 | |||
| 114 | If the file has a ``Commentary'' header, then it is used as the long | ||
| 115 | description. | ||
| 116 | |||
| 117 | The version of the package comes either from the ``Package-Version'' | ||
| 118 | header, if it exists, or from the ``Version'' header. A package is | ||
| 119 | required to have a version number. Each release of a package must be | ||
| 120 | accompanied by an increase in the version number. | ||
| 121 | |||
| 122 | If the file has a ``Package-Requires'' header, then that is used as | ||
| 123 | the package dependencies. Otherwise, the package is assumed not to | ||
| 124 | have any dependencies. | ||
| 125 | |||
| 126 | A single-file package cannot have an Info manual. | ||
| 127 | |||
| 128 | The file will be scanned for autoload cookies at install time. | ||
| 129 | @xref{Autoload}. | ||
| 130 | |||
| 131 | @node Multi-file Packages | ||
| 132 | @section Multi-file Packages | ||
| 133 | @cindex multi-file packages | ||
| 134 | |||
| 135 | A multi-file package is just a @file{.tar} file. While less | ||
| 136 | convenient to create than a single-file package, a multi-file package | ||
| 137 | also offers more features: it can include an Info manual, multiple | ||
| 138 | Emacs Lisp files, and also other data files needed by a package. | ||
| 139 | |||
| 140 | The contents of the @file{.tar} file must all appear beneath a | ||
| 141 | single directory, named after the package and version. Files can | ||
| 142 | appear in subdirectories of this top-most directory, but Emacs Lisp | ||
| 143 | code will only be found (and thus byte-compiled) at the top-most | ||
| 144 | level. Also, the @file{.tar} file is typically also given this same | ||
| 145 | name. For example, if you are distributing version 1.3 of the | ||
| 146 | superfrobnicator, the package file would be named | ||
| 147 | ``superfrobnicator-1.3.tar'' and the contents would all appear in the | ||
| 148 | directory @file{superfrobnicator-1.3} in that @file{.tar}. | ||
| 149 | |||
| 150 | The package must include a @file{-pkg.el} file, named after the | ||
| 151 | package. In our example above, this file would be called | ||
| 152 | @file{superfrobnicator-pkg.el}. This file must have a single form in | ||
| 153 | it, a call to @code{define-package}. The package dependencies and | ||
| 154 | brief description are taken from this form. | ||
| 155 | |||
| 156 | @defun define-package name version &optional docstring requirements | ||
| 157 | Define a package. @var{name} is the name of the package, a string. | ||
| 158 | @var{version} is the package's version, a string. It must be in a | ||
| 159 | form that can be understood by @code{version-to-list}. | ||
| 160 | @var{docstring} is the short description of the package. | ||
| 161 | @var{requirements} is a list of required packages and their versions. | ||
| 162 | @end defun | ||
| 163 | |||
| 164 | If a @file{README} file exists in the content directory, then it is | ||
| 165 | used as the long description. | ||
| 166 | |||
| 167 | If the package has an Info manual, you should distribute the needed | ||
| 168 | info files, plus a @file{dir} file made with @command{install-info}. | ||
| 169 | @xref{Invoking install-info, Invoking install-info, Invoking | ||
| 170 | install-info, texinfo, Texinfo}. | ||
| 171 | |||
| 172 | Do not include any @file{.elc} files in the package. Those will be | ||
| 173 | created at install time. Note that there is no way to control the | ||
| 174 | order in which files are byte-compiled; your package must be robust | ||
| 175 | here. | ||
| 176 | |||
| 177 | The installation process will scan all the @file{.el} files in the | ||
| 178 | package for autoload cookies. @xref{Autoload}. They are extracted | ||
| 179 | into a @file{-autoloads.el} file (e.g., | ||
| 180 | @file{superfrobnicator-autoloads.el}), so do not include a file of | ||
| 181 | that name in your package. | ||
| 182 | |||
| 183 | Any other files in the @file{.tar} file are simply unpacked when the | ||
| 184 | package is installed. This can be useful if your package needs | ||
| 185 | auxiliary data files --- e.g., icons or sounds. | ||
| 186 | |||
| 187 | Emacs Lisp code installed via the package manager must take special | ||
| 188 | care to be location-independent. One easy way to do this is to make | ||
| 189 | references to auxiliary data files relative to @var{load-file-name}. | ||
| 190 | For example: | ||
| 191 | |||
| 192 | @smallexample | ||
| 193 | (defconst superfrobnicator-base (file-name-directory load-file-name)) | ||
| 194 | |||
| 195 | (defun superfrobnicator-fetch-image (file) | ||
| 196 | (expand-file-name file superfrobnicator-base)) | ||
| 197 | @end smallexample | ||
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index de281b0e147..bf3afcf53ee 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi | |||
| @@ -1052,6 +1052,31 @@ Please use that command to see a list of the meaningful keywords. | |||
| 1052 | This field is important; it's how people will find your package when | 1052 | This field is important; it's how people will find your package when |
| 1053 | they're looking for things by topic area. To separate the keywords, you | 1053 | they're looking for things by topic area. To separate the keywords, you |
| 1054 | can use spaces, commas, or both. | 1054 | can use spaces, commas, or both. |
| 1055 | |||
| 1056 | @item Package-Version | ||
| 1057 | If @samp{Version} is not suitable for use by the package manager, then | ||
| 1058 | a package can define @samp{Package-Version}; it will be used instead. | ||
| 1059 | This is handy if @samp{Version} is an RCS id or something else that | ||
| 1060 | cannot be parsed by @code{version-to-list}. @xref{Packaging Basics}. | ||
| 1061 | |||
| 1062 | @item Package-Requires | ||
| 1063 | If this exists, it names packages on which the current package depends | ||
| 1064 | for proper operation. @xref{Packaging Basics}. This is used by the | ||
| 1065 | package manager both at download time (to ensure that a complete set | ||
| 1066 | of packages is downloaded) and at activation time (to ensure that a | ||
| 1067 | package is activated if and only if all its dependencies have been). | ||
| 1068 | |||
| 1069 | Its format is a list of lists. The @code{car} of each sub-list is the | ||
| 1070 | name of a package, as a symbol. The @code{cadr} of each sub-list is | ||
| 1071 | the minimum acceptable version number, as a string. For instance: | ||
| 1072 | |||
| 1073 | @smallexample | ||
| 1074 | ;; Package-Requires: ((gnus "1.0") (bubbles "2.7.2")) | ||
| 1075 | @end smallexample | ||
| 1076 | |||
| 1077 | The package code automatically defines a package named @samp{emacs} | ||
| 1078 | with the version number of the currently running Emacs. This can be | ||
| 1079 | used to require a minimal version of Emacs for a package. | ||
| 1055 | @end table | 1080 | @end table |
| 1056 | 1081 | ||
| 1057 | Just about every Lisp library ought to have the @samp{Author} and | 1082 | Just about every Lisp library ought to have the @samp{Author} and |
diff --git a/doc/lispref/vol1.texi b/doc/lispref/vol1.texi index ae90d23c70b..6e8237334ac 100644 --- a/doc/lispref/vol1.texi +++ b/doc/lispref/vol1.texi | |||
| @@ -180,6 +180,8 @@ Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}. | |||
| 180 | * System Interface:: Getting the user id, system type, environment | 180 | * System Interface:: Getting the user id, system type, environment |
| 181 | variables, and other such things. | 181 | variables, and other such things. |
| 182 | 182 | ||
| 183 | * Packaging:: Preparing Lisp code for distribution. | ||
| 184 | |||
| 183 | Appendices | 185 | Appendices |
| 184 | 186 | ||
| 185 | * Antinews:: Info for users downgrading to Emacs 22. | 187 | * Antinews:: Info for users downgrading to Emacs 22. |
| @@ -1415,6 +1417,12 @@ Operating System Interface | |||
| 1415 | * Session Management:: Saving and restoring state with | 1417 | * Session Management:: Saving and restoring state with |
| 1416 | X Session Management. | 1418 | X Session Management. |
| 1417 | 1419 | ||
| 1420 | Preparing Lisp code for distribution | ||
| 1421 | |||
| 1422 | * Packaging Basics:: The basic concepts of Emacs Lisp packages. | ||
| 1423 | * Simple Packages:: How to package a single .el file. | ||
| 1424 | * Multi-file Packages:: How to package multiple files. | ||
| 1425 | |||
| 1418 | Starting Up Emacs | 1426 | Starting Up Emacs |
| 1419 | 1427 | ||
| 1420 | * Startup Summary:: Sequence of actions Emacs performs at startup. | 1428 | * Startup Summary:: Sequence of actions Emacs performs at startup. |
diff --git a/doc/lispref/vol2.texi b/doc/lispref/vol2.texi index 6de6ac7182b..b36e06eae3a 100644 --- a/doc/lispref/vol2.texi +++ b/doc/lispref/vol2.texi | |||
| @@ -179,6 +179,8 @@ Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}. | |||
| 179 | * System Interface:: Getting the user id, system type, environment | 179 | * System Interface:: Getting the user id, system type, environment |
| 180 | variables, and other such things. | 180 | variables, and other such things. |
| 181 | 181 | ||
| 182 | * Packaging:: Preparing Lisp code for distribution. | ||
| 183 | |||
| 182 | Appendices | 184 | Appendices |
| 183 | 185 | ||
| 184 | * Antinews:: Info for users downgrading to Emacs 22. | 186 | * Antinews:: Info for users downgrading to Emacs 22. |
| @@ -1414,6 +1416,12 @@ Operating System Interface | |||
| 1414 | * Session Management:: Saving and restoring state with | 1416 | * Session Management:: Saving and restoring state with |
| 1415 | X Session Management. | 1417 | X Session Management. |
| 1416 | 1418 | ||
| 1419 | Preparing Lisp code for distribution | ||
| 1420 | |||
| 1421 | * Packaging Basics:: The basic concepts of Emacs Lisp packages. | ||
| 1422 | * Simple Packages:: How to package a single .el file. | ||
| 1423 | * Multi-file Packages:: How to package multiple files. | ||
| 1424 | |||
| 1417 | Starting Up Emacs | 1425 | Starting Up Emacs |
| 1418 | 1426 | ||
| 1419 | * Startup Summary:: Sequence of actions Emacs performs at startup. | 1427 | * Startup Summary:: Sequence of actions Emacs performs at startup. |