summaryrefslogtreecommitdiff
path: root/devdocs/elisp/simple-packages.html
blob: 5e858952589e0b24d8c98d14fb185e6976e573ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 <h3 class="section">Simple Packages</h3>   <p>A simple package consists of a single Emacs Lisp source file. The file must conform to the Emacs Lisp library header conventions (see <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Headers.html">Library Headers</a>). The package’s attributes are taken from the various headers, as illustrated by the following example: </p> <div class="example"> <pre class="example">;;; superfrobnicator.el --- Frobnicate and bifurcate flanges

;; Copyright (C) 2011 Free Software Foundation, Inc.
</pre>
<pre class="example">

;; Author: J. R. Hacker &lt;jrh@example.com&gt;
;; Version: 1.3
;; Package-Requires: ((flange "1.0"))
;; Keywords: multimedia, hypermedia
;; URL: https://example.com/jrhacker/superfrobnicate

…

;;; Commentary:

;; This package provides a minor mode to frobnicate and/or
;; bifurcate any flanges you desire.  To activate it, just type
…

;;;###autoload
(define-minor-mode superfrobnicator-mode
…
</pre>
</div> <p>The name of the package is the same as the base name of the file, as written on the first line. Here, it is ‘<samp>superfrobnicator</samp>’. </p> <p>The brief description is also taken from the first line. Here, it is ‘<samp>Frobnicate and bifurcate flanges</samp>’. </p> <p>The version number comes from the ‘<samp>Package-Version</samp>’ header, if it exists, or from the ‘<samp>Version</samp>’ header otherwise. One or the other <em>must</em> be present. Here, the version number is 1.3. </p> <p>If the file has a ‘<samp>;;; Commentary:</samp>’ section, this section is used as the long description. (When displaying the description, Emacs omits the ‘<samp>;;; Commentary:</samp>’ line, as well as the leading comment characters in the commentary itself.) </p> <p>If the file has a ‘<samp>Package-Requires</samp>’ header, that is used as the package dependencies. In the above example, the package depends on the ‘<samp>flange</samp>’ package, version 1.0 or higher. See <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Headers.html">Library Headers</a>, for a description of the ‘<samp>Package-Requires</samp>’ header. If the header is omitted, the package has no dependencies. </p> <p>The ‘<samp>Keywords</samp>’ and ‘<samp>URL</samp>’ headers are optional, but recommended. The command <code>describe-package</code> uses these to add links to its output. The ‘<samp>Keywords</samp>’ header should contain at least one standard keyword from the <code>finder-known-keywords</code> list. </p> <p>The file ought to also contain one or more autoload magic comments, as explained in <a href="packaging-basics">Packaging Basics</a>. In the above example, a magic comment autoloads <code>superfrobnicator-mode</code>. </p> <p>See <a href="package-archives">Package Archives</a>, for an explanation of how to add a single-file package to a package archive. </p><div class="_attribution">
  <p class="_attribution-p">
    Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
    <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Simple-Packages.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Simple-Packages.html</a>
  </p>
</div>