annotate doc/lispref/package.texi @ 112409:0222e3f822e3

Add ERT manual to Info dir file.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 21 Jan 2011 23:01:40 -0500
parents 6378d1b57038
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109983
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
1 @c -*-texinfo-*-
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
2 @c This is part of the GNU Emacs Lisp Reference Manual.
112275
6378d1b57038 Add 2011 to remaining FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 109983
diff changeset
3 @c Copyright (C) 2010, 2011
109983
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
4 @c Free Software Foundation, Inc.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
5 @c See the file elisp.texi for copying conditions.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
6 @setfilename ../../info/package
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
7 @node Packaging, Antinews, System Interface, Top
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
8 @chapter Preparing Lisp code for distribution
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
9 @cindex packaging
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
10
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
11 Emacs provides a standard way for Emacs Lisp code to be distributed
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
12 to users. This approach lets users easily download, install,
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
13 uninstall, and upgrade Lisp code that they might want to use.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
14
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
15 A @dfn{package} is simply one or more files, formatted and bundled
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
16 in a particular way. Typically a package includes primarily Emacs
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
17 Lisp code, but it is possible to create other kinds of packages as
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
18 well.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
19
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
20 @menu
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
21 * Packaging Basics:: The basic concepts of Emacs Lisp packages.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
22 * Simple Packages:: How to package a single .el file.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
23 * Multi-file Packages:: How to package multiple files.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
24 @end menu
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
25
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
26 @node Packaging Basics
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
27 @section Packaging Basics
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
28 @cindex packaging basics
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
29
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
30 A package has a few attributes:
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
31 @cindex package attributes
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
32
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
33 @table @asis
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
34 @item Name
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
35 A string, the name of the package. This attribute is mandatory. If
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
36 it does not exist, the package cannot be installed by the package
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
37 manager.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
38
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
39 @item Version
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
40 A version number, which is anything that can be parsed by
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
41 @code{version-to-list}. This attribute is mandatory. If it does not
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
42 exist, the package cannot be installed by the package manager.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
43
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
44 @item Brief description
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
45 This is shown to the user in the package menu buffer. It is just a
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
46 single line. On a terminal with 80 characters per line, there are
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
47 only 36 characters available in the package menu mode for showing the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
48 brief description, so it is best to keep it very brief. If no brief
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
49 name is given, an empty string is used.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
50
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
51 @item Long description
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
52 This can be a @file{README} file or the like. This is available to
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
53 the user before the package is installed, via the package menu. It
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
54 should more fully describe the package and its capabilities, so a user
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
55 can read it to decide whether he wants to install the package. This
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
56 attribute is optional.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
57
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
58 @item Dependencies
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
59 This is a list of other packages and their minimal acceptable
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
60 versions. This is used both at download time (to make sure all the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
61 needed code is available) and at activation time (to ensure a package
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
62 is only activated if all its dependencies have been successfully
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
63 activated). This attribute is optional.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
64
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
65 @item Manual
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
66 A package can optionally include an Info manual.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
67 @end table
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
68
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
69 Conceptually, a package goes through several state transitions (in
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
70 reality some of these transitions are grouped together):
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
71
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
72 @table @asis
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
73 @item Download
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
74 Fetch the package from somewhere.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
75
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
76 @item Install
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
77 Unpack the package, or write a @file{.el} file into the appropriate
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
78 install directory. This step also includes extracting autoloads and
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
79 byte-compiling the Emacs Lisp code.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
80
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
81 @item Activate
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
82 Update @code{load-path} and @code{Info-directory-list} and evaluate
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
83 the autoloads, so that the package is ready for the user to use.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
84 @end table
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
85
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
86 It is best for users if packages do not do too much work at
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
87 activation time. The best approach is to have activation consist of
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
88 some autoloads and little more.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
89
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
90 @node Simple Packages
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
91 @section Simple Packages
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
92 @cindex single file packages
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
93
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
94 The simplest package consists of a single Emacs Lisp source file.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
95 In this case, all the attributes of the package (@pxref{Packaging
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
96 Basics}) are taken from this file.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
97
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
98 The package system expects this @file{.el} file to conform to the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
99 Emacs Lisp library header conventions. @xref{Library Headers}.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
100
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
101 The name of the package is the same as the base name of the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
102 @file{.el} file, as written in the first comment line. For example,
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
103 given the header line:
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
104
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
105 @smallexample
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
106 ;;; superfrobnicator.el --- frobnicate and bifurcate flanges
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
107 @end smallexample
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
108
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
109 the package name will be @samp{superfrobnicator}.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
110
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
111 The short description of the package is also taken from the first
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
112 line of the file.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
113
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
114 If the file has a ``Commentary'' header, then it is used as the long
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
115 description.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
116
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
117 The version of the package comes either from the ``Package-Version''
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
118 header, if it exists, or from the ``Version'' header. A package is
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
119 required to have a version number. Each release of a package must be
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
120 accompanied by an increase in the version number.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
121
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
122 If the file has a ``Package-Requires'' header, then that is used as
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
123 the package dependencies. Otherwise, the package is assumed not to
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
124 have any dependencies.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
125
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
126 A single-file package cannot have an Info manual.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
127
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
128 The file will be scanned for autoload cookies at install time.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
129 @xref{Autoload}.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
130
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
131 @node Multi-file Packages
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
132 @section Multi-file Packages
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
133 @cindex multi-file packages
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
134
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
135 A multi-file package is just a @file{.tar} file. While less
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
136 convenient to create than a single-file package, a multi-file package
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
137 also offers more features: it can include an Info manual, multiple
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
138 Emacs Lisp files, and also other data files needed by a package.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
139
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
140 The contents of the @file{.tar} file must all appear beneath a
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
141 single directory, named after the package and version. Files can
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
142 appear in subdirectories of this top-most directory, but Emacs Lisp
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
143 code will only be found (and thus byte-compiled) at the top-most
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
144 level. Also, the @file{.tar} file is typically also given this same
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
145 name. For example, if you are distributing version 1.3 of the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
146 superfrobnicator, the package file would be named
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
147 ``superfrobnicator-1.3.tar'' and the contents would all appear in the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
148 directory @file{superfrobnicator-1.3} in that @file{.tar}.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
149
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
150 The package must include a @file{-pkg.el} file, named after the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
151 package. In our example above, this file would be called
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
152 @file{superfrobnicator-pkg.el}. This file must have a single form in
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
153 it, a call to @code{define-package}. The package dependencies and
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
154 brief description are taken from this form.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
155
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
156 @defun define-package name version &optional docstring requirements
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
157 Define a package. @var{name} is the name of the package, a string.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
158 @var{version} is the package's version, a string. It must be in a
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
159 form that can be understood by @code{version-to-list}.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
160 @var{docstring} is the short description of the package.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
161 @var{requirements} is a list of required packages and their versions.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
162 @end defun
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
163
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
164 If a @file{README} file exists in the content directory, then it is
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
165 used as the long description.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
166
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
167 If the package has an Info manual, you should distribute the needed
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
168 info files, plus a @file{dir} file made with @command{install-info}.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
169 @xref{Invoking install-info, Invoking install-info, Invoking
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
170 install-info, texinfo, Texinfo}.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
171
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
172 Do not include any @file{.elc} files in the package. Those will be
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
173 created at install time. Note that there is no way to control the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
174 order in which files are byte-compiled; your package must be robust
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
175 here.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
176
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
177 The installation process will scan all the @file{.el} files in the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
178 package for autoload cookies. @xref{Autoload}. They are extracted
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
179 into a @file{-autoloads.el} file (e.g.,
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
180 @file{superfrobnicator-autoloads.el}), so do not include a file of
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
181 that name in your package.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
182
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
183 Any other files in the @file{.tar} file are simply unpacked when the
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
184 package is installed. This can be useful if your package needs
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
185 auxiliary data files --- e.g., icons or sounds.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
186
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
187 Emacs Lisp code installed via the package manager must take special
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
188 care to be location-independent. One easy way to do this is to make
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
189 references to auxiliary data files relative to @var{load-file-name}.
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
190 For example:
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
191
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
192 @smallexample
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
193 (defconst superfrobnicator-base (file-name-directory load-file-name))
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
194
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
195 (defun superfrobnicator-fetch-image (file)
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
196 (expand-file-name file superfrobnicator-base))
a44dc3503539 * vol2.texi (Top): Update.
Tom Tromey <tromey@redhat.com>
parents:
diff changeset
197 @end smallexample