Appendix D. Sharing Your Code

If you write a terrific new Emacs mode, or feature, or game, or whatever, it’s in the spirit of free software for you to share it with others by posting it to the gnu.emacs.sources newsgroup. This appendix describes the conventions for sharing Emacs Lisp code.

Preparing Source Files

Before sharing your code with the world, it’s considerate to first test it with reasonable thoroughness, fixing any bugs you happen to find. Learn more about testing and debugging in Appendix C.

Once the code is working the way you’d like it to, you should add a comment block to the beginning of each source file describing the file, its copyright (see below), its authorship, its version information, and other commentary. Here’s a typical beginning:

;;; foretell.el -- predict what the user will do
;;; Copyright 1996 by Mortimer J. Hacker <mjh@mjh.net>
;;; Foretell is free software distributed under the terms
;;; of the GNU General Public License, version 2.  For details,
;;; see the file COPYING.
;;; This is version 1.7 of 5 August 1996.
;;; For more information about Foretell, subscribe to the
;;; Foretell mailing list by sending a message to
;;; <foretell-request@mjh.net>.

The file should end with a comment line like this:

;;; foretell.el ends here

which will help identify the file boundary if the file is sent through email (which might cause signature and other lines to be appended).

If your package includes more ...

Get Writing GNU Emacs Extensions now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.