aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/ChangeLog11
-rw-r--r--doc/lispref/anti.texi2
-rw-r--r--doc/lispref/elisp.texi10
-rw-r--r--doc/lispref/os.texi2
-rw-r--r--doc/lispref/package.texi197
-rw-r--r--doc/lispref/tips.texi25
-rw-r--r--doc/lispref/vol1.texi8
-rw-r--r--doc/lispref/vol2.texi8
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 @@
12010-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
12010-08-25 Eli Zaretskii <eliz@gnu.org> 122010-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
162Appendices 164Appendices
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
1399Preparing 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
1397Starting Up Emacs 1405Starting 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
12to users. This approach lets users easily download, install,
13uninstall, and upgrade Lisp code that they might want to use.
14
15 A @dfn{package} is simply one or more files, formatted and bundled
16in a particular way. Typically a package includes primarily Emacs
17Lisp code, but it is possible to create other kinds of packages as
18well.
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
35A string, the name of the package. This attribute is mandatory. If
36it does not exist, the package cannot be installed by the package
37manager.
38
39@item Version
40A version number, which is anything that can be parsed by
41@code{version-to-list}. This attribute is mandatory. If it does not
42exist, the package cannot be installed by the package manager.
43
44@item Brief description
45This is shown to the user in the package menu buffer. It is just a
46single line. On a terminal with 80 characters per line, there are
47only 36 characters available in the package menu mode for showing the
48brief description, so it is best to keep it very brief. If no brief
49name is given, an empty string is used.
50
51@item Long description
52This can be a @file{README} file or the like. This is available to
53the user before the package is installed, via the package menu. It
54should more fully describe the package and its capabilities, so a user
55can read it to decide whether he wants to install the package. This
56attribute is optional.
57
58@item Dependencies
59This is a list of other packages and their minimal acceptable
60versions. This is used both at download time (to make sure all the
61needed code is available) and at activation time (to ensure a package
62is only activated if all its dependencies have been successfully
63activated). This attribute is optional.
64
65@item Manual
66A package can optionally include an Info manual.
67@end table
68
69 Conceptually, a package goes through several state transitions (in
70reality some of these transitions are grouped together):
71
72@table @asis
73@item Download
74Fetch the package from somewhere.
75
76@item Install
77Unpack the package, or write a @file{.el} file into the appropriate
78install directory. This step also includes extracting autoloads and
79byte-compiling the Emacs Lisp code.
80
81@item Activate
82Update @code{load-path} and @code{Info-directory-list} and evaluate
83the 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
87activation time. The best approach is to have activation consist of
88some 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.
95In this case, all the attributes of the package (@pxref{Packaging
96Basics}) are taken from this file.
97
98 The package system expects this @file{.el} file to conform to the
99Emacs 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,
103given the header line:
104
105@smallexample
106;;; superfrobnicator.el --- frobnicate and bifurcate flanges
107@end smallexample
108
109the package name will be @samp{superfrobnicator}.
110
111 The short description of the package is also taken from the first
112line of the file.
113
114 If the file has a ``Commentary'' header, then it is used as the long
115description.
116
117 The version of the package comes either from the ``Package-Version''
118header, if it exists, or from the ``Version'' header. A package is
119required to have a version number. Each release of a package must be
120accompanied by an increase in the version number.
121
122 If the file has a ``Package-Requires'' header, then that is used as
123the package dependencies. Otherwise, the package is assumed not to
124have 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
136convenient to create than a single-file package, a multi-file package
137also offers more features: it can include an Info manual, multiple
138Emacs 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
141single directory, named after the package and version. Files can
142appear in subdirectories of this top-most directory, but Emacs Lisp
143code will only be found (and thus byte-compiled) at the top-most
144level. Also, the @file{.tar} file is typically also given this same
145name. For example, if you are distributing version 1.3 of the
146superfrobnicator, the package file would be named
147``superfrobnicator-1.3.tar'' and the contents would all appear in the
148directory @file{superfrobnicator-1.3} in that @file{.tar}.
149
150 The package must include a @file{-pkg.el} file, named after the
151package. In our example above, this file would be called
152@file{superfrobnicator-pkg.el}. This file must have a single form in
153it, a call to @code{define-package}. The package dependencies and
154brief description are taken from this form.
155
156@defun define-package name version &optional docstring requirements
157Define 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
159form 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
165used as the long description.
166
167 If the package has an Info manual, you should distribute the needed
168info files, plus a @file{dir} file made with @command{install-info}.
169@xref{Invoking install-info, Invoking install-info, Invoking
170install-info, texinfo, Texinfo}.
171
172 Do not include any @file{.elc} files in the package. Those will be
173created at install time. Note that there is no way to control the
174order in which files are byte-compiled; your package must be robust
175here.
176
177 The installation process will scan all the @file{.el} files in the
178package for autoload cookies. @xref{Autoload}. They are extracted
179into a @file{-autoloads.el} file (e.g.,
180@file{superfrobnicator-autoloads.el}), so do not include a file of
181that name in your package.
182
183 Any other files in the @file{.tar} file are simply unpacked when the
184package is installed. This can be useful if your package needs
185auxiliary data files --- e.g., icons or sounds.
186
187 Emacs Lisp code installed via the package manager must take special
188care to be location-independent. One easy way to do this is to make
189references to auxiliary data files relative to @var{load-file-name}.
190For 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.
1052This field is important; it's how people will find your package when 1052This field is important; it's how people will find your package when
1053they're looking for things by topic area. To separate the keywords, you 1053they're looking for things by topic area. To separate the keywords, you
1054can use spaces, commas, or both. 1054can use spaces, commas, or both.
1055
1056@item Package-Version
1057If @samp{Version} is not suitable for use by the package manager, then
1058a package can define @samp{Package-Version}; it will be used instead.
1059This is handy if @samp{Version} is an RCS id or something else that
1060cannot be parsed by @code{version-to-list}. @xref{Packaging Basics}.
1061
1062@item Package-Requires
1063If this exists, it names packages on which the current package depends
1064for proper operation. @xref{Packaging Basics}. This is used by the
1065package manager both at download time (to ensure that a complete set
1066of packages is downloaded) and at activation time (to ensure that a
1067package is activated if and only if all its dependencies have been).
1068
1069Its format is a list of lists. The @code{car} of each sub-list is the
1070name of a package, as a symbol. The @code{cadr} of each sub-list is
1071the 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
1077The package code automatically defines a package named @samp{emacs}
1078with the version number of the currently running Emacs. This can be
1079used 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
183Appendices 185Appendices
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
1420Preparing 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
1418Starting Up Emacs 1426Starting 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
182Appendices 184Appendices
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
1419Preparing 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
1417Starting Up Emacs 1425Starting Up Emacs
1418 1426
1419* Startup Summary:: Sequence of actions Emacs performs at startup. 1427* Startup Summary:: Sequence of actions Emacs performs at startup.