@c -*-texinfo-*-
@c
@c Copyright (C) 2002, 2003 Free Software Foundation, Inc.
@c Copyright (C) 2003 Jake Colman <jake.colman@xemacs.org>
@c
@c @setfilename prog-modes.info
@ifinfo
@dircategory XEmacs Editor
@direntry
* Programming Modes: (prog-modes).	Programming Modes for XEmacs.
@end direntry
@end ifinfo

@ignore
@copying
This manual is part of XEmacs.

XEmacs is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

XEmacs is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with XEmacs; see the file COPYING.  If not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
@end copying
@end ignore

@node Top, Copying, (dir), (dir)
@chapter The Programming Modes Package

@ifinfo
This Info file contains the manual for the Programming Modes package.
@end ifinfo

The node name for each entry in the menu is the name of the elisp file
containing the code that implements the functionality described.  It is
highly recommended that you briefly peruse the elisp source code since it can
provide valuable information on usage and technique.  This can easily be done
by typing @code{C-x 4 l <filename> RET} where <filename> is the name of the
elisp file to be loaded.

In many cases, the @code{customize} command can be used to customize a
package's options.  For those packages that support @code{customize}, the
appropriate command is given.  Otherwise, peruse the code as described above
to learn how to set the package's options.

When you have entered a mode, you may get more info on the capabilities of
that mode by pressing @kbd{C-h m}. You may also get online help describing
functions provided by the mode by pressing @code{C-h f <function name>}.

@menu
* Copying::                     

* asm-mode::                    Editing Assembler Code
* autoconf-mode::               Editing Autoconf Input Files
* awk-mode::                    Editing AWK Code
* cl-indent::                   Enhanced Lisp-Indent Mode
* cvs::                         Light CVS Support
* diff-mode::                   Viewing and Editing Context Diffs
* eiffel::                      Editing Eiffel Code
* icon::                        Editing Icon Code
* javascript-mode::             Editing JavaScript Code
* ksh-mode::                    Editing Shell Script (sh, ksh, bash) Code
* m4-mode::                     Editing m4 Code
* make-mode::                   Editing Makefiles
* mode-compile::                Compiling Files According to Major-Mode
* modula2::                     Editing Module-2 Code
* old-c-mode::                  Editing C Code
* p4::                          Integration with Perforce Version Control
* pascal::                      Editing Pascal Code
* php-mode::                    Editing PHP Code
* postscript::                  Editing PostScript Programs
* prolog::                      Editing and Running Prolog Code
* rexx-mode::                   Editing REXX Code
* rpm-spec-mode::               Editing RPM Specification Files
* simula::                      Editing SIMULA 87 Code
* sql::                         Specialized Mode for SQL Interpreters
* tcl::                         Editing Tcl Code
* teco::                        Teco Interpreter
* uil-mode::                    Editing Motif UIL Code
* verilog-mode::                Editing Verilog HDL Source
* vrml-mode::                   Editing VRML (.wrl) Files

* XEmacs License::              XEmacs License
@end menu

@node Copying, asm-mode, Top, Top
@chapter Copying

This document may be redistributed, verbatim or in modified form, under
the terms of the GNU General Public License, version 2 or any later
version.  The same terms apply to the libraries it documents.  A copy
of the General Public License is provided as an Appendix.

Most XEmacs documentation has its own license, which is an ancestor of
the GNU Free Documentation License (@dfn{FDL}), and whose terms are
quite similar to those imposed by GNU on Emacs documentation.  Why is
this manual licensed differently (under the GNU General Public License,
or @dfn{GPL}), and why does it have to be distributed separately from
the XEmacs User's Guide and the XEmacs Lisp Reference Manual?

Taking the second question first, XEmacs is @dfn{community-owned}
software.  That is, unlike GNU Emacs, there is no monopoly copyright
holder.  Many of us, including the original Lucid authors, have
contributed our copyrights to the Free Software Foundation (FSF), and of
course much content is derived from GNU Emacs, and therefore is held by
the FSF.  Another large chunk is held by Sun Microsystems, and a few
individual authors hold copyright to thousands of lines each.  But many
individuals hold copyright to only a few dozen lines.  Like the Linux
kernel, copyright ownership is distributed throughout a community.

However, its license is ``copyleft,'' @emph{i.e.}, it @emph{requires}
that you redistribute it under terms @emph{identical} to those under
which you received it, unless you have explicit permission of the
copyright holder.  Because of the multiple owners, determining the
ownership of any given part of XEmacs is tedious, and perhaps
impossible.  For practical purposes, then, the license of any
substantial chunk of existing XEmacs content cannot be changed, except
to a later version of the GPL, for those parts under GPL.  (That is due
to the @emph{explicit} permission to change to a later version of the
GPL, present in every file of XEmacs.)

Unfortunately, this severe restriction means that the GPL, FDL, and the
XEmacs documentation license (@dfn{XDL}) are @emph{mutually
incompatible}.  That is, content licensed under any of the GPL, FDL, or
XDL @emph{may not} be mixed with content licensed under either of the
other two without changing the license of some of the content.  But this
requires permission of the copyright holder, which is often difficult or
impossible to get.

For example, you @emph{may not} take comments or docstrings from XEmacs
code and add them to the Lispref to mend a gap in the latter's coverage.
You @emph{may not} copy text from the Lispref into docstrings in the
code.  And you @emph{may not} copy text from the GNU Emacs Lisp
Reference to the XEmacs Lisp Reference Manual.  (In this case it is at
least trivial to ask permission, although it is rather unclear whether
it would be granted.)

In fact, parts of this document were derived by copying from XEmacs code
under the GPL, without any further permission from the authors.  Thus,
this document must be distributed under the GPL, as a ``volume''
separate from the XEmacs documentation under the XDL.  Note that the
``mere aggregation'' clauses allow us to distribute in the same
tarball.  But incorporating it as a node in the Lispref is prohibited,
even if done by inclusion.

A bit of advocacy:

If you look carefully at the additional restrictions imposed by the
soi-disant "free" documentation licenses, you discover that they are
simply proprietary restrictions guaranteeing a certain amount of
@emph{unpaid} political advertising to the Free Software Foundation and
GNU Project (and in the case of the FDL, this is extended to commercial
advertising by authors of original or derived works).  Whether this is
``ethically justified'' or not is a difficult question.  What is certain
is that there is little social benefit to these terms (since the license
documents themselves contain the advocacy and must be included with any
distribution).

I conclude it makes sense for XEmacs to reduce its restrictions, where
possible, to the ``least common denominator,'' the GNU General Public
License.

@node asm-mode, autoconf-mode, Copying, Top
@chapter Editing Assembler Code

This mode is used for editing Assembler code.  The mode is automatically
invoked for buffers visting any file ending with one of the following
extensions: @file{.s}, @file{.S}, @file{.asm}.

The mode is based on text-mode.  It defines a private abbrev table that can
be used to save abbrevs for assembler mnemonics.  It binds just five keys:

@table @kbd

@item TAB
Tab to next tab stop

@item :
Outdent preceding label, tab to tab stop

@item comment char 
Place or move comment.  @code{asm-comment-char} specifies which character
this is; you can use a different character in different Asm mode buffers.
Alternatively, you may set this variable in @code{asm-mode-set-comment-hook},
which is called near the beginning of mode initialization.

@item C-j, C-m
Newline and tab to tab stop

@end table

Code is automatically indented to the first tab stop level.

Turning on Asm mode runs the hook @code{asm-mode-hook} at the end of
initialization.

To configure this package, type:

@example
  M-x customize-group RET asm RET
@end example

@node autoconf-mode, awk-mode, asm-mode, Top
@chapter Editing Autoconf Input Files

This mode is used for editing autoconf input files.  It is automatically
invoked for buffers visting the following types of files:

@itemize @bullet

@item any file ending with an extension of @file{.m4} 

@item any file named @file{configure} ending with an extension of either
@file{.in} or @file{.ac}.  

@end itemize

To configure this package please view the source code.  This can be done by
typing @kbd{C-x 4 l autoconf-mode}.

@menu
* About Autoconf: about-autoconf.
@end menu

@node about-autoconf,  , autoconf-mode, autoconf-mode
@section About Autoconf

Autoconf is an extensible package of m4 macros that produce shell scripts to
automatically configure software source code packages. These scripts can
adapt the packages to many kinds of UNIX-like systems without manual user
intervention. Autoconf creates a configuration script for a package from a
template file that lists the operating system features that the package can
use, in the form of m4 macro calls.

@node awk-mode, cl-indent, autoconf-mode, Top
@chapter Editing AWK Code 

This mode is used for editing Awk code.  It is automatically invoked for
buffers visiting the following types of files:

@itemize @bullet

@item any file ending with an extension of @file{.awk}.

@item any file that has an interpretor line (the "shebang" line) specifying
"awk".  

@end itemize

The mode operates much like C mode except for the syntax of comments.  It
uses the same keymap as C mode and has the same variables for customizing
indentation.  It has its own abbrev table and its own syntax table.

Turning on AWK mode calls the value of the variable @code{awk-mode-hook} with
no args, if that value is non-nil.

NOTE: This library is obsolete.  Support for AWK is now available directly
via the cc-mode package.  @xref{AWK Mode, , , cc-mode, CC Mode Manual}., for
details.

@menu
* About Awk: about-awk.
@end menu

@node about-awk,  , awk-mode, awk-mode
@section About Awk

Awk is a text-processing programming language.  It is a useful and simple
tool for manipulating text.

@node cl-indent, cvs, awk-mode, Top
@chapter Enhanced Lisp-Indent Mode

This package provides an extension to lisp-mode.  It supplies a single entry
point, @code{common-lisp-indent-function}, which performs indentation in the
preferred style for Common Lisp code.  To enable it add the following to your
@code{user-init-file}:

@example
  (setq lisp-indent-function 'common-lisp-indent-function)
@end example

To configure this package, type:

@example
  M-x customize-group RET lisp-indent RET
@end example

@node cvs, diff-mode, cl-indent, Top
@chapter Light CVS Support

This package provides simple CVS support within the editing session.

The package provides the following features:

@itemize @bullet

@item Displays the CVS revision in the mode line.
@item Compares file changes between CVS revisions using @code{ediff}.
@item Keystrokes and menu entries to execute `cvs status', `cvs log' and `cvsann'.
@item Simple interface to `cvs commit' and `cvs update' commands.
@item Status listing per directory.
@item @code{msb} support (better buffer selection).
@item @code{dired} support.
@item Softlink tree support.
@item Little module support (status and update).

@end itemize

To install this library, add the following to your @code{user-init-file}:

@example
  (require 'cvs)
@end example

To configure this package please view the source code.  This can be done by
typing @kbd{C-x 4 l cvs}.

For related packages please see @ref{Top, PCL-CVS, , pcl-cvs, Pcl-cvs -
The Emacs Front-End to CVS}. and @ref{Version Control, , ,xemacs, The XEmacs
Editor}.

@menu
* About CVS: about-cvs.
@end menu

@node about-cvs,  , cvs, cvs
@section About CVS

CVS is the Concurrent Versions System, an open-source network-transparent
version control system.  More information on CVS can be found at
@uref{http://www.cvshome.org,CVS Home}.

@node diff-mode, eiffel, cvs, Top
@chapter Viewing and Editing Context Diffs

This mode faciliates viewing and editing of context diffs.  It is
automatically invoked buffers visting any file ending with one of the
following extensions: @file{.diff?}, @file{.patch}, @file{.rej}.

The mode provides support for font-lock, outline, navigation commands,
editing and various conversions as well as jumping.

The following key mappings are defined:

@multitable {M-delete  } {diff-reverse-direction}
@item @code{C-c}             @tab << Prefix Command >>
@item @code{M-A}             @tab diff-ediff-patch
@item @code{M-C}             @tab diff-unified->context
@item @code{M-K}             @tab diff-file-kill
@item @code{M-N}             @tab diff-file-next
@item @code{M-P}             @tab diff-file-prev
@item @code{M-R}             @tab diff-reverse-direction
@item @code{M-U}             @tab diff-context->unified
@item @code{M-W}             @tab widen
@item @code{M-k}             @tab diff-hunk-kill
@item @code{M-n}             @tab diff-hunk-next
@item @code{M-o}             @tab diff-goto-source
@item @code{M-p}             @tab diff-hunk-prev
@item @code{M-r}             @tab diff-restrict-view
@item @code{M-@{}            @tab diff-file-prev
@item @code{M-@}}            @tab diff-file-next
@item @code{M-delete}        @tab scroll-down
@item @code{M-return}        @tab diff-goto-source
@item @code{M-space}         @tab scroll-up
@item @code{M-C-m}           @tab diff-goto-source

@item @code{C-c C-a}         @tab diff-apply-hunk
@item @code{C-c C-c}         @tab diff-goto-source
@item @code{C-c C-s}         @tab diff-split-hunk
@item @code{C-c C-t}         @tab diff-test-hunk
@end multitable

To configure this package, type:

@example
  M-x customize-group RET diff-mode RET
@end example

@node eiffel, icon, diff-mode, Top
@chapter Editing Eiffel Code

This mode is used for editing Eiffel code.  It is automatically invoked for
buffers visting any file ending in an extension of @file{.e}.

The following key mappings are defined:

@multitable {C-c C-c  } {diff-reverse-direction}
@item @code{return}          @tab reindent-then-newline-and-indent
@item @code{C-c}             @tab << Prefix Command >>
@item @code{C-j}             @tab newline-and-indent
@item @code{C-x}             @tab << Prefix Command >>
@item @code{M-'}             @tab eif-feature-quote
@item @code{M-q}             @tab eif-fill-paragraph
@item @code{M-C-a}           @tab eif-beginning-of-feature
@item @code{M-C-e}           @tab eif-end-of-feature
@item @code{M-C-q}           @tab eif-indent-construct
@item @code{C-c C-c}         @tab eif-compile
@item @code{C-c C-o}         @tab eif-set-compile-options
@item @code{C-c C-r}         @tab eif-run
@item @code{C-c C-s}         @tab eif-short
@item @code{C-x n}           @tab << Prefix Command >>
@item @code{C-x n d}         @tab eif-narrow-to-feature
@end multitable

To configure this package, type:

@example
  M-x customize-group RET eiffel RET
@end example

@menu
* About Eiffel: about-eiffel.
@end menu

@node about-eiffel,  , eiffel, eiffel
@section About Eiffel

The Eiffel programming language was created by Bertrand Meyer and developed
by his company, Interactive Software Engineering (ISE) of Goleta, CA in 1985.
More information on Eiffel can be found at
@uref{http://www.engin.umd.umich.edu/CIS/course.des/cis400/eiffel/eiffel.html,the
Eiffel Web Site}.

@node icon, javascript-mode, eiffel, Top
@chapter Editing Icon Code

This mode is used for editing Icon code.  It is automatically invoked for
buffers visting any file ending in an extension of @file{.icn}.

The mode provides the following features:

@itemize @bullet
@item Expression and list commands understand all Icon brackets.
@item Tab indents for Icon code.
@item Paragraphs are separated by blank lines only.
@item Delete converts tabs to spaces as it moves back.
@end itemize

The following key mappings are defined:

@multitable {M-backspace  } {backward-delete-char-untabify}
@item @code{@{}              @tab electric-icon-brace
@item @code{@}}              @tab electric-icon-brace
@item @code{delete}          @tab backward-delete-char-untabify
@item @code{menu-bar}        @tab << Prefix command "Icon" >>
@item @code{M-backspace}     @tab mark-icon-function
@item @code{M-C-a}           @tab beginning-of-icon-defun
@item @code{M-C-e}           @tab end-of-icon-defun
@item @code{M-C-h}           @tab mark-icon-function
@item @code{M-C-q}           @tab indent-icon-exp
@end multitable

The variables controlling indentation style are:

@table @code

@item icon-tab-always-indent
Non-nil means TAB in Icon mode should always reindent the current line,
regardless of where in the line point is when the TAB command is used.

@item icon-auto-newline
Non-nil means automatically newline before and after braces
inserted in Icon code.

@item icon-indent-level
Indentation of Icon statements within surrounding block.
The surrounding block's indentation is the indentation
of the line on which the open-brace appears.

@item icon-continued-statement-offset
Extra indentation given to a substatement, such as the
then-clause of an if or body of a while.

@item icon-continued-brace-offset
Extra indentation given to a brace that starts a substatement.
This is in addition to `icon-continued-statement-offset'.

@item icon-brace-offset
Extra indentation for line if it starts with an open brace.

@item icon-brace-imaginary-offset
An open brace following other text is treated as if it were
this far to the right of the start of its line.

@end table

Turning on Icon mode calls the value of the variable @code{icon-mode-hook}
with no args, if that value is non-nil.

To configure this package, type:

@example
  M-x customize-group RET icon RET
@end example

@menu
* About Icon: about-icon.
@end menu

@node about-icon,  , icon, icon
@section About Icon

Icon is a high-level, general-purpose programming language with a large
repertoire of features for processing data structures and character
strings. Icon is an imperative, procedural language with a syntax reminiscent
of C and Pascal, but with semantics at a much higher level.  More information
on Icon can be found at @uref{http://www.cs.arizona.edu/icon/,The Icon
Programming Language}.

@node javascript-mode, ksh-mode, icon, Top
@chapter Editing JavaScript Code

This mode is used for editing JavaScript code.  It is automatically invoked
for buffers visting any file ending in an extension of @file{.js} or
@file{.pac}.

See the documentation for @code{c++-mode}: JavaScript mode is an extension of
it (@pxref{Top, CC Mode, , cc-mode, CC Mode Manual}).  Use the hook
@code{javascript-mode-hook} to execute custom code when entering JavaScript
mode.

The following key mappings are defined:

@multitable {M-C-kp-right  } {c-show-syntactic-information}
@item @code{#}               @tab c-electric-pound
@item @code{(, )}            @tab c-electric-paren
@item @code{*}               @tab c-electric-star
@item @code{,}               @tab c-electric-semi&comma
@item @code{/}               @tab c-electric-slash
@item @code{:}               @tab c-electric-colon
@item @code{;}               @tab c-electric-semi&comma
@item @code{<}               @tab c-electric-lt-gt
@item @code{>}               @tab c-electric-lt-gt
@item @code{@{}              @tab c-electric-brace
@item @code{@}}              @tab c-electric-brace
@item @code{backspace}       @tab c-electric-backspace
@item @code{delete}          @tab c-electric-delete
@item @code{return}          @tab c-context-line-break
@item @code{tab}             @tab c-indent-command
@item @code{C-c}             @tab << Prefix Command >>
@item @code{C-i}             @tab c-indent-command
@item @code{C-m}             @tab c-context-line-break
@item @code{C-x}             @tab << Prefix Command >>
@item @code{M-a}             @tab c-beginning-of-statement
@item @code{M-c}             @tab c-comment-edit-at-point
@item @code{M-e}             @tab c-end-of-statement
@item @code{M-j}             @tab c-indent-new-comment-line
@item @code{M-q}             @tab c-fill-paragraph
@item @code{M-backspace}     @tab backward-kill-word
@item @code{M-backward}      @tab backward-kill-word
@item @code{M-delete}        @tab backward-kill-word
@item @code{M-linefeed}      @tab c-indent-new-comment-line
@item @code{M-C-h}           @tab backward-kill-word
@item @code{M-C-j}           @tab c-indent-new-comment-line
@item @code{M-C-q}           @tab c-indent-exp
@item @code{M-C-kp-left}     @tab c-beginning-of-statement
@item @code{M-C-kp-right}    @tab c-end-of-statement
@item @code{M-C-left}        @tab c-beginning-of-statement
@item @code{M-C-right}       @tab c-end-of-statement
@item @code{C-c .}           @tab c-set-style
@item @code{C-c C-\}         @tab c-backslash-region
@item @code{C-c C-a}         @tab c-toggle-auto-state
@item @code{C-c C-b}         @tab c-submit-bug-report
@item @code{C-c C-c}         @tab comment-region
@item @code{C-c C-d}         @tab c-toggle-hungry-state
@item @code{C-c C-n}         @tab c-forward-conditional
@item @code{C-c C-o}         @tab c-set-offset
@item @code{C-c C-p}         @tab c-backward-conditional
@item @code{C-c C-q}         @tab c-indent-defun
@item @code{C-c C-s}         @tab c-show-syntactic-information
@item @code{C-c C-t}         @tab c-toggle-auto-hungry-state
@item @code{C-c C-u}         @tab c-up-conditional
@item @code{C-x f}           @tab c-fill-paragraph
@end multitable

To configure this package, type:

@example
  M-x customize-group RET javascript RET
@end example

@menu
* About JavaScript: about-javascript.
@end menu

@node about-javascript,  , javascript-mode, javascript-mode
@section About JavaScript

JavaScript is a compact, object-based scripting language for developing
client and server Internet applications.

@node ksh-mode, m4-mode, javascript-mode, Top
@chapter Editing Shell Script (sh, ksh, bash) Code

This mode is used for editing shell scripts written for the Bourne (sh), Korn
(ksh) or Bourne Again (bash) shells.  It is NOT automatically invoked for any
particular file extension.  To invoke this mode while editing a file, type
@code{M-x ksh-mode}.

The following key mappings are defined:

@multitable {C-c tab  } {reindent-then-newline-and-indent}
@item @code{linefeed}        @tab reindent-then-newline-and-indent
@item @code{tab}             @tab ksh-indent-line
@item @code{C-c}             @tab << Prefix Command >>
@item @code{C-i}             @tab ksh-indent-line
@item @code{C-j}             @tab reindent-then-newline-and-indent
@item @code{M-tab}           @tab ksh-complete-symbol
@item @code{M-C-i}           @tab ksh-complete-symbol
@item @code{C-c tab}         @tab ksh-completion-init-and-pickup
@item @code{C-c C-i}         @tab ksh-completion-init-and-pickup
@end multitable

The variables controlling indentation style are:

@table @code

@item ksh-indent
Indentation of ksh statements with respect to containing block.
Default value is 2.

@item ksh-case-indent
Additional indentation for statements under case items.
Default value is nil which will align the statements one position 
past the ")" of the pattern.

@item ksh-case-item-offset
Additional indentation for case items within a case statement.
Default value is 2.

@item ksh-group-offset
Additional indentation for keywords "do" and "then".
Default value is -2.

@item ksh-brace-offset
Additional indentation of "@{" under functions or brace groupings.
Default value is 0.

@item ksh-multiline-offset
Additional indentation of line that is preceded of a line ending with a
@code{\} to make it continue on next line.

@item ksh-tab-always-indent
Controls the operation of the @code{TAB} key. If t (the default), always
reindent the current line.  If nil, indent the current line only if
point is at the left margin or in the line's indentation; otherwise
insert a tab.

@item ksh-match-and-tell
If non-nil echo in the minibuffer the matching compound command
for the "done", "@}", "fi", or "esac". Default value is t.

@item ksh-align-to-keyword
Controls whether nested constructs align from the keyword or
the current indentation. If non-nil, indentation will be relative to
the column the keyword starts. If nil, indentation will be relative to
the current indentation of the line the keyword is on.
The default value is non-nil.

@item ksh-comment-regexp
Regular expression used to recognize comments. Customize to support
ksh-like languages. Default value is "\s *#".

@end table

An example of how to set up this mode is as follows:

@example
  (setq ksh-mode-hook
       (function (lambda ()
          (font-lock-mode 1)             ;; font-lock the buffer
          (setq ksh-indent 8)
	  (setq ksh-group-offset -8)
	  (setq ksh-brace-offset -8)   
          (setq ksh-tab-always-indent t)
          (setq ksh-match-and-tell t)
          (setq ksh-align-to-keyword t)	;; Turn on keyword alignment
	  )))
@end example

To configure this package please view the source code.  This can be done by
typing @kbd{C-x 4 l ksh-mode}.

For a related package, see @code{sh-script}.

@node m4-mode, make-mode, ksh-mode, Top
@chapter Editing m4 Code

This mode is used for editing m4 macro definitions.  It is NOT automatically
invoked for any particular file extension.  To invoke this mode while editing
a file, type @code{M-x m4-mode}.

The mode has most of the syntax right (i.e., sexp motion commands work, but
function motion commands don't).  It also sets up font-lock for colorization.

To configure this package please view the source code.  This can be done by
typing @kbd{C-x 4 l m4-mode}.

NOTE: The preferred package for editing m4 code is auto-conf mode.
@xref{autoconf-mode}., for details.

@menu
* About m4: about-m4.
@end menu

@node about-m4,  , m4-mode, m4-mode
@section About m4

m4 is a general purpose macro processor that can be used to preprocess C and
assembly language programs, among other things. Besides the straightforward
replacement of one string of text by another, m4 lets you perform:

@itemize @bullet

@item integer arithmetic 
@item file inclusion 
@item conditional macro expansion 
@item string and substring manipulation 

@end itemize

@node make-mode, mode-compile, m4-mode, Top
@chapter Editing Makefiles

This mode is used for editing Makefiles.  It is automatically invoked for
for buffers visting the following types of files:

@itemize @bullet

@item any file ending with an extension of @file{.ma?ke?} or @file{.am} 

@item any file named @file{GNU[Mm]akefile} or @file{[Mm]akefile} with an
extension of @file{.in}.

@item any file that has an interpretor line (the "shebang" line) specifying
"make".

@end itemize

The mode knows about Makefile syntax and defines @kbd{M-n} and @kbd{M-p} to
move to next and previous productions.

The keys @kbd{$}, @kbd{=}, @kbd{:} and @kbd{.} are electric; they try to help
you fill in a macro reference, macro definition, ordinary target name, or
special target name, respectively.  Such names are completed using a list of
targets and macro names parsed out of the makefile.  This list is
automatically updated, if necessary, whenever you invoke one of these
commands.  You can force it to be updated with @kbd{C-c C-p}.

The command @kbd{C-c C-f} adds certain filenames in the current directory as
targets.  You can filter out filenames by setting the variable
@code{makefile-ignored-files-in-pickup-regex}.

The command @kbd{C-c C-u} grinds for a bit, then pops up a report buffer
showing which target names are up-to-date with respect to their
prerequisites, which targets are out-of-date, and which have no
prerequisites.

The command @kbd{C-c C-b} pops up a browser window listing all target and
macro names.  You can mark or unmark items wit @kbd{C-c SPC}, and insert all
marked items back in the Makefile with @kbd{C-c TAB}.

The command @kbd{C-c TAB} in the makefile buffer inserts a GNU make builtin.
You will be prompted for the builtin's args.

The following key mappings are defined:

@multitable {C-c return  } {makefile-browser-insert-selection-and-quit}
@item @code{C-c}             @tab << Prefix Command >>
@item @code{M-n}             @tab makefile-next-dependency
@item @code{M-p}             @tab makefile-previous-dependency
@item @code{M-tab}           @tab makefile-complete
@item @code{M-C-i}           @tab makefile-complete
@item @code{C-c :}           @tab makefile-insert-target-ref
@item @code{C-c tab}         @tab makefile-insert-gmake-function
@item @code{C-c C-\}         @tab makefile-backslash-region
@item @code{C-c C-b}         @tab makefile-switch-to-browser
@item @code{C-c C-c}         @tab comment-region
@item @code{C-c C-f}         @tab makefile-pickup-filenames-as-targets
@item @code{C-c C-i}         @tab makefile-insert-gmake-function
@item @code{C-c C-p}         @tab makefile-pickup-everything
@item @code{C-c C-u}         @tab makefile-create-up-to-date-overview
@end multitable

In the browser, use the following keys:

@multitable {C-c return  } {makefile-browser-insert-selection-and-quit}
@item @code{I}               @tab makefile-browser-insert-selection-and-quit
@item @code{i}               @tab makefile-browser-insert-selection
@item @code{n}               @tab makefile-browser-next-line
@item @code{p}               @tab makefile-browser-previous-line
@item @code{q}               @tab makefile-browser-quit
@item @code{space}           @tab makefile-browser-toggle
@item @code{C-c}             @tab << Prefix Command >>
@item @code{C-n}             @tab makefile-browser-next-line
@item @code{C-p}             @tab makefile-browser-previous-line
@item @code{C-c return}      @tab makefile-browser-insert-continuation
@item @code{C-c C-m}         @tab makefile-browser-insert-continuation
@end multitable

Makefile mode can be configured by modifying the following variables:

@table @code

@item makefile-browser-buffer-name:
Name of the macro- and target browser buffer.

@item makefile-target-colon:
The string that gets appended to all target names
inserted by @code{makefile-insert-target}.
":" or "::" are quite common values.

@item makefile-macro-assign:
The string that gets appended to all macro names
inserted by @code{makefile-insert-macro}.
The normal value should be " = ", since this is what
standard make expects.  However, newer makes such as dmake
allow a larger variety of different macro assignments, so you
might prefer to use " += " or " := " .

@item makefile-tab-after-target-colon:
If you want a @code{TAB} (instead of a space) to be appended after the
target colon, then set this to a non-nil value.

@item makefile-browser-leftmost-column:
Number of blanks to the left of the browser selection mark.

@item makefile-browser-cursor-column:
Column in which the cursor is positioned when it moves
up or down in the browser.

@item makefile-browser-selected-mark:
String used to mark selected entries in the browser.

@item makefile-browser-unselected-mark:
String used to mark unselected entries in the browser.

@item makefile-browser-auto-advance-after-selection-p:
If this variable is set to a non-nil value the cursor
will automagically advance to the next line after an item
has been selected in the browser.

@item makefile-pickup-everything-picks-up-filenames-p:
If this variable is set to a non-nil value then
@code{makefile-pickup-everything} also picks up filenames as targets
(i.e. it calls @code{makefile-pickup-filenames-as-targets}), otherwise
filenames are omitted.

@item makefile-cleanup-continuations-p:
If this variable is set to a non-nil value then Makefile mode
will assure that no line in the file ends with a backslash
(the continuation character) followed by any whitespace.
This is done by silently removing the trailing whitespace, leaving
the backslash itself intact.
IMPORTANT: Please note that enabling this option causes Makefile mode
to MODIFY A FILE WITHOUT YOUR CONFIRMATION when "it seems necessary".

@item makefile-browser-hook:
A function or list of functions to be called just before the
browser is entered. This is executed in the makefile buffer.

@item makefile-special-targets-list:
List of special targets. You will be offered to complete
on one of those in the minibuffer whenever you enter a `.'.
at the beginning of a line in Makefile mode.

@end table

To configure this package, type:

@example
  M-x customize-group RET makefile RET
@end example

@menu
* About Make: about-make.
@end menu

@node about-make,  , make-mode, make-mode
@section About Make

A Makefile is used by a `make' utility to automatically determine which
pieces of a large program need to be recompiled, and to issue the commands to
recompile them.  @xref{Top, Make, , make, GNU Make Manual}., for details.

@node mode-compile, modula2, make-mode, Top
@chapter Compiling Files According to Major-Mode

The @code{compile} command is very rudimentary in its creation of its
compilation command, using "make -k" by default.  This package provides an
intelligent replacement for the @code{compile} command. @xref{Compilation, ,
,xemacs, The XEmacs Editor}., for details.

The @code{mode-compile} command functions as a layer above @code{compile}.
Its purpose is mainly to build a smarter compile command for @code{compile}
to execute. This compile command is built according to number of parameters:

@itemize @bullet

@item the major-mode
@item presence or absence of a makefile in the current directory
@item the @code{buffer-file-name} and extension
@item contents of the current buffer (`main' function, "#!/path/shell", ...)
@item and more ... (see below)

@end itemize

Most of these parameters are highly customizable through Emacs Lisp variables
(to be set in your @code{user-init-file} or through the Customization menu).
Running @code{mode-compile} after a universal-argument (@kbd{C-u}) allows
remote compilations; the user is prompted for the host name to execute the
compilation command.  The @code{mode-compile-kill} function terminates a
running compilation session launched by @code{mode-compile}.

By default, @code{mode-compile} is very verbose and waits a user-specified
number of seconds after displaying each message to give the user time to read
it.  The variables @code{mode-compile-expert-p} and
@code{mode-compile-reading-time} can be used to change this behaviour.  On
Windows-based systems, the variable @code{mode-compile-other-frame-p} will
create a new frame and launch the compilation command in it.

@menu
* compile-cust::                Customization
* compile-compilation-mode::    compilation-mode
* compile-makefile-mode::       makefile-mode
* compile-emacs-lisp-mode::     emacs-lisp-mode, lisp-interaction-mode
* compile-dired-mode::          dired-mode
* compile-sh-mode::             sh-mode, csh-mode, zsh-mode
* compile-c?perl-mode::         c?perl-mode
* compile-tcl-mode::            tcl-mode
* compile-c-mode::              c-mode, c++-mode
* compile-ada-mode::            ada-mode
* compile-fortran-mode::        fortran-mode
* compile-java-mode::           java-mode
* compile-python-mode::         python-mode
* compile-message-mode::        message-mode
* compile-catchall::            Miscellenaus Modes
@end menu

@node compile-cust, compile-compilation-mode, mode-compile, mode-compile
@section Customization

This section explains how the @code{compile-command} is built according
to the @code{major-mode} and how to customize it.  The major modes currently
supported are:

@multitable {lisp-interaction-mode} {lisp-interaction-mode} {lisp-interaction-mode}

@item ada-mode              @tab c++-mode           @tab c-mode
@item c?perl-mode           @tab compilation-mode   @tab csh-mode
@item dired-mode            @tab emacs-lisp-mode    @tab fortran-mode
@item fundamental-mode      @tab indented-text-mode @tab java-mode
@item lisp-interaction-mode @tab makefile-mode      @tab python-mode
@item sh-mode               @tab tcl-mode           @tab text-mode
@item zsh-mode

@end multitable

For other modes a default behaviour is provided.

When running @code{mode-compile} or @code{mode-compile-kill} the hooks
@code{mode-compile-(before|after)-(compile|kill)-hook} are executed.  The
current buffer can be automatically saved if
@code{mode-compile-always-save-buffer-p} is set to @code{t}.  All the
modified buffers can be automatically saved if @code{mode-compile-save-all-p}
is set to @code{t}.

To configure this package, type:

@example
  M-x customize-group RET compilation RET
@end example

@node compile-compilation-mode, compile-makefile-mode, compile-cust, mode-compile
@section compilation-mode

Calls @code{compile} with the last compile command.

@node compile-makefile-mode, compile-emacs-lisp-mode, compile-compilation-mode, mode-compile
@section makefile-mode

The makefile is run with make through @code{compile} (user is prompted for
the rule to run, see variable @code{mode-compile-preferred-default-makerule}
to see how a default choice could be selected).

@node compile-emacs-lisp-mode, compile-dired-mode, compile-makefile-mode, mode-compile
@section emacs-lisp-mode, lisp-interaction-mode

If the buffer is a @file{.el} file we @code{byte-compile} it to produce a
@file{.elc} file.  Otherwise, just @code{byte-compile} the buffer (this does
not use @code{compile} but @code{byte-compile}).

@node compile-dired-mode, compile-sh-mode, compile-emacs-lisp-mode, mode-compile
@section dired-mode

Find a @file{makefile} in the directory and run make with it (like in
@code{makefile-mode}), else try to @code{byte-recompile} all @file{.el} files
older than their associated @file{.elc} files (unlike
@code{byte-recompile-directory} this is not recursive), finally if no
@file{.el} files are present ask compilation command to user by calling
@code{default-compile}.  To find a @file{makefile} a regexp is provided which
name is @code{mode-compile-makefile-regexp}.

@node compile-sh-mode, compile-c?perl-mode, compile-dired-mode, mode-compile
@section sh-mode, csh-mode, zsh-mode

Run "[cz]?sh" with debugging arguments as specified in
@code{[cz]?sh-dbg-flags} on the currently edited file.

@node compile-c?perl-mode, compile-tcl-mode, compile-sh-mode, mode-compile
@section c?perl-mode

Run file with "perl -w" (can step through errors with compile's @code{next-error}
command).

@node compile-tcl-mode, compile-c-mode, compile-c?perl-mode, mode-compile
@section tcl-mode

Run file with "wish" (can step through errors with compile's
@code{next-error} command).

@node compile-c-mode, compile-ada-mode, compile-tcl-mode, mode-compile
@section c-mode, c++-mode

First it tries to see if there is a @file{makefile} in the
directory. Makefiles to look for are specified by the variable
@code{mode-compile-makefile-regexp}.  If yes two cases could happen: there is
only one makefile so use it, or there is more than one (sometimes when you
need to write portable soft you could have some makefiles by system:
SunOs.make, HP.make ...), in that case prompt to user for choice (with smart
completion).  Once the makefile has been selected it extract the rules from
it and ask to user to choose a rule to make (with smart completion, see
variable @code{mode-compile-preferred-default-makerule} to see how a default
choice could be selected).

There are some cases where no makefiles are presents (YES I KNOW this is bad
practice but you sometimes have no needs to write a Makefile). In that case
the function try to build the most intelligent compilation command by using
the favourite user C/C++ compiler: value of environment variable "CC" or
"CXX" or first found, in the PATH, of compilers specified in variable
@code{cc-compilers-list} or @code{c++-compilers-list}.  Then it look for the
varenv "CFLAGS" of "CXXFLAGS" to append to the compiler command, find the
file to compile: <name-of-the-file-to-compiled>.(c|cc|C|cpp) (see *) and ask
for confirmation.  If you really trust mode-compile will build the right
command and want to bypass confirmation you could set the variable
@code{mode-compile-never-edit-command-p} to @code{t}.

@node compile-ada-mode, compile-fortran-mode, compile-c-mode, mode-compile
@section ada-mode

Same as c/c++-mode but run Ada compiler on the Ada file.  There are no
companion file and no way to find a main function in Ada.

@node compile-fortran-mode, compile-java-mode, compile-ada-mode, mode-compile
@section fortran-mode

Same as c-mode but run Fortran compiler on .[Ff](or)? files.

@node compile-java-mode, compile-python-mode, compile-fortran-mode, mode-compile
@section java-mode

Same as c-mode but call "javac" without the -o option on .java files

@node compile-python-mode, compile-message-mode, compile-java-mode, mode-compile
@section python-mode

Run file with "python" (can step through errors with compile's
@code{next-error} command).

@node compile-message-mode, compile-catchall, compile-python-mode, mode-compile
@section message-mode

Run @code{message-send}.

@node compile-catchall,  , compile-message-mode, mode-compile
@section Miscellenaus Modes

This handles @code{fundamental-mode}, @code{text-mode},
@code{indented-text-mode} and any unknown modes.

Try to guess what the file is by

@itemize @bullet

@item Looking at its name and extension (see variable
@code{mode-compile-filename-regexp-alist}).

@item Looking at string "#!/path/shell" at first line to extract shell to run
the script with (see variable @code{mode-compile-shell-alist}).

@item Looking at a makefile in current directory.

@item Calling @code{compile} with the last compile command which is asked to
be edited by user

@end itemize

The @code{kill-compile} command is then bound dynamically (buffer-local).

@node modula2, old-c-mode, mode-compile, Top
@chapter Editing Module-2 Code

This mode is used for editing Modula-2 code.  It is NOT automatically invoked
for any particular file extension.  To invoke this mode while editing a file,
type @code{M-x modula-2-mode}.

The mode provides convenient abbrevs for Modula-2 keywords, knows about the
standard layout rules, and supports a native compile command.

All control constructs of Modula-2 can be reached by typing C-c followed by
the first character of the construct.

The following key mappings are defined:

@multitable {C-c C-z suspend Emacs} {Control-c Control-w with}
@item C-c b begin             @tab C-c c case
@item C-c d definition        @tab C-c e else
@item C-c f for               @tab C-c h header
@item C-c i if                @tab C-c m module
@item C-c l loop              @tab C-c o or
@item C-c p procedure         @tab Control-c Control-w with
@item C-c r record            @tab C-c s stdio
@item C-c t type              @tab C-c u until
@item C-c v var               @tab C-c w while
@item C-c x export            @tab C-c y import
@item C-c @{ begin-comment    @tab C-c @} end-comment
@item C-c C-z suspend Emacs   @tab C-c C-t toggle
@item C-c C-c compile         @tab M-x m2-next-error next-error
@item C-c C-l link
@end multitable

Following are some important variables:

@table @code
@item m2-indent
controls the number of spaces for each indentation.
@item m2-compile-command
holds the command to compile a Modula-2 program.
@item m2-link-command 
holds the command to link a Modula-2 program.
@end table

To configure this package, type:

@example
  M-x customize-group RET modula2 RET
@end example

@menu
* About Modula-2: about-modula2.
@end menu

@node about-modula2,  , modula2, modula2
@section About Modula-2

Modula-2 is a programming language developed by Niklaus Wirth at ETH in
Zurich, Switzerland in the late 70's. Wirth also developed Algol-W, Pascal,
Modula, and Oberon.

Modula-2 corrects some of the deficiencies of Pascal. It is suitable for
learning programming, for large projects written and maintained in the
fashion of professional software engineers, and for real time embedded
systems. Modula-2 is small, expressive, easy to learn and to read.

@node old-c-mode, p4, modula2, Top
@chapter Editing C Code

This is a smart editing mode for C code.  It knows a lot about C syntax and
tries to position the cursor according to C layout conventions.  You can
change the details of the layout style with option variables.

The mode provides the following features:

@itemize @bullet
@item Expression and list commands understand all C brackets.
@item Tab indents for C code.
@item Comments are delimited with /* ... */.
@item Paragraphs are separated by blank lines only.
@item Delete converts tabs to spaces as it moves back.
@end itemize

The variables controlling indentation style are:

@table @code

@item c-tab-always-indent
Non-nil means TAB in C mode should always reindent the current line,
regardless of where in the line point is when the TAB command is used.

@item c-auto-newline
Non-nil means automatically newline before and after braces,
and after colons and semicolons, inserted in C code.

@item c-indent-level
Indentation of C statements within surrounding block.
The surrounding block's indentation is the indentation
of the line on which the open-brace appears.

@item c-continued-statement-offset
Extra indentation given to a substatement, such as the
then-clause of an if or body of a while.

@item c-continued-brace-offset
Extra indentation given to a brace that starts a substatement.
This is in addition to c-continued-statement-offset.

@item c-brace-offset
Extra indentation for line if it starts with an open brace.

@item c-brace-imaginary-offset
An open brace following other text is treated as if it were
this far to the right of the start of its line.

@item c-argdecl-indent
Indentation level of declarations of C function arguments.

@item c-label-offset
Extra indentation for line that is a label, or case or default.

@end table

NOTE: This package has been obsoleted by the cc-mode package (@pxref{Top, CC
Mode, , cc-mode, CC Mode Manual}).  cc-mode can be quite slow, however, on
large files, even on fast machines.  This version works with no problems on
the XEmacs source code and is very very fast.

To configure this package, type:

@example
  M-x customize-group RET old-c RET
@end example

@node p4, pascal, old-c-mode, Top
@chapter Integration with Perforce Version Control

This package provides simple integration with Perforce Version Control.

To use this package, add the following line to your @code{user-init-file}:

@example
  (load-library "p4")
@end example

To configure this package, type:

@example
  M-x customize-group RET p4 RET
@end example

@menu
* About Perforce: about-perforce.
@end menu

@node about-perforce,  , p4, p4
@section About Perforce

The Perforce SCM System features comprehensive software configuration
management capabilities built around a scalable client/server
architecture. Requiring only TCP/IP, developers can access the Perforce
Server through a variety of Perforce clients (Windows GUI, Web, or
Command-Line). Perforce can be deployed quickly and easily, and requires
minimal administration1, even for large or distributed sites.

More information on Perforce can be found at @uref{http://www.perforce.com}.

@node pascal, php-mode, p4, Top
@chapter Editing Pascal Code

This mode is used for editing Pascal code.  It is automatically invoked for
buffers visting any file ending with an extension of @file{.pas}.

The mode provides the following capabilities:

@itemize @bullet
@item TAB indents for Pascal code.  
@item Delete converts tabs to spaces as it moves back.
@item @code{pascal-complete-word} completes the word around current point
with respect \ to position in code
@item @code{pascal-show-completions} shows all possible completions at this
point.
@end itemize

Other useful functions are:

@table @code
@item pascal-mark-defun
Mark function.

@item pascal-insert-block
insert begin ... end;

@item pascal-star-comment
insert (* ... *)

@item pascal-comment-area
Put marked area in a comment, fixing nested comments.

@item pascal-uncomment-area
Uncomment an area commented with @code{pascal-comment-area}.

@item pascal-beg-of-defun
Move to beginning of current function.

@item pascal-end-of-defun
Move to end of current function.

@item pascal-goto-defun
Goto function prompted for in the minibuffer.

@item pascal-outline
Enter pascal-outline-mode (see also pascal-outline).

@end table

The variables controlling indentation/edit style are:

@table @code

@item pascal-indent-level
Indentation of Pascal statements with respect to containing block.

@item pascal-case-indent
Indentation for case statements.

@item pascal-auto-newline
Non-nil means automatically newline after semicolons and the punctuation
mark after an end.

@item pascal-tab-always-indent
Non-nil means TAB in Pascal mode should always reindent the current line,
regardless of where in the line point is when the TAB command is used.

@item pascal-auto-endcomments
Non-nil means a comment @{ ... @} is set after the ends which ends cases and
functions. The name of the function or case will be set between the braces.

@item pascal-auto-lineup
List of contexts where auto lineup of :'s or ='s should be done.

@end table

See also the user variables @code{pascal-type-keywords},
@code{pascal-start-keywords} and @code{pascal-separator-keywords}.

Turning on Pascal mode calls the value of the variable
@code{pascal-mode-hook} with no args, if that value is non-nil.

To configure this package, type:

@example
  M-x customize-group RET pascal RET
@end example

@node php-mode, postscript, pascal, Top
@chapter Editing PHP Code

PHP mode is a major mode for editing PHP 3 and 4 source code.  It is
automatically invoked for buffers visting the following files of files:

@itemize @bullet
@item any file ending with one of the following extensions: @file{.phps},
@file{.php3}, @file{.php4}
@item any file ending with the extension @file{.phtml}
@item any file ending with the extension @file{.inc}
@end itemize

The mode is an extension of cc-mode; thus it inherits all cc-mode's
navigation functionality (@pxref{Top, CC Mode, , cc-mode, CC Mode Manual}).
But it colors according to the PHP grammar and indents according to the PEAR
coding guidelines.  It also includes a couple of handy IDE-type features such
as documentation search and a source and class browser.

For colorization, turn on @code{global-font-lock} or add the following to
your @code{user-init-file}:

@example
  (add-hook 'php-mode-user-hook 'turn-on-font-lock)
@end example

To use abbrev-mode, add lines like this to your @code{user-init-file}:

@example
  (add-hook 'php-mode-user-hook
    '(lambda () (define-abbrev php-mode-abbrev-table "ex" "extends")))
@end example

To make php-mode compatible with html-mode, see @uref{http://php-mode.sf.net}.

To configure this package, type:

@example
  M-x customize-group RET php RET
@end example

@menu
* About PHP: about-php.
@end menu

@node about-php,  , php-mode, php-mode
@section About PHP

PHP is a widely-used general-purpose scripting language that is especially
suited for Web development and can be embedded into HTML.  For more
information, see @uref{http://www.php.net/}.

@node postscript, prolog, php-mode, Top
@chapter Editing PostScript Programs

This mode is used for editing PostScript programs.  It is automatically
invoked for buffers visiting any file ending with an extension of @file{.cps}
or @file{.ps}.

@code{C-c C-c} will send the contents of the buffer to the NeWS server using
psh(1).  @code{C-c |} sends the current region.  @code{C-c !} starts an
interactive psh(1) window which will be used for subsequent @code{C-c C-c} or
@code{C-c |} commands.

In this mode, @code{TAB} and @code{M-C-\} attempt to indent code based on the
position of @{@}, [], and begin/end pairs.  The variable
@code{ps-indent-level} controls the amount of indentation used inside arrays
and begin/end pairs.

The following key mappings are defined:

@multitable {C-c C-c  } {<< Prefix Command >>}
@item @code{tab}             @tab ps-tab
@item @code{C-c}             @tab << Prefix Command >>
@item @code{C-i}             @tab ps-tab
@item @code{C-c !}           @tab ps-shell
@item @code{C-c |}           @tab ps-execute-region
@item @code{C-c C-c}         @tab ps-execute-buffer
@end multitable

@code{M-x postscript-mode} calls the value of the variable
@code{postscript-mode-hook} with no args, if that value is non-nil.

To configure this package please view the source code.  This can be done by
typing @kbd{C-x 4 l postscript}.

@menu
* About PostScript: about-postscript.
@end menu

@node about-postscript,  , postscript, postscript
@section About PostScript

PostScript is a programming language optimized for printing graphics and text
(whether on paper, film, or CRT is immaterial). In the jargon of the day, it
is a page description language. It was introduced by Adobe in 1985 and first
(to my knowledge) appeared in the Apple LaserWriter. The main purpose of
PostScript was to provide a convenient language in which to describe images
in a device independent manner. This device independence means that the image
is described without reference to any specific device features (e.g. printer
resolution) so that the same description could be used on any PostScript
printer (say, a LaserWriter or a Linotron) without modification.

@node prolog, rexx-mode, postscript, Top
@chapter Editing and Running Prolog Code

This mode is used for editing Prolog code.  It is automatically invoked for
buffers visting any file ending with an of extension @file{.prolog}.

The mode knows about Prolog syntax and comments, and can send regions to an
inferior Prolog interpreter process.

Blank lines and `%%...' separate paragraphs.  `%'s start comments.

The following key mappings are defined:

@multitable {M-C-x  } {prolog-consult-region}
@item @code{tab}             @tab prolog-indent-line
@item @code{C-i}             @tab prolog-indent-line
@item @code{M-C-x}           @tab prolog-consult-region
@end multitable

Entry to this mode calls the value of @code{prolog-mode-hook} if that value
is non-nil.

To configure this package, type:

@example
  M-x customize-group RET prolog RET
@end example

@node rexx-mode, rpm-spec-mode, prolog, Top
@chapter Editing REXX Code

This mode is used for editing REXX code.  It is automatically invoked for
buffers visting the following types of files:

@itemize @bullet
@item any file ending with an extension of @file{.rexx}.  
@item any file that has an interpretor line (the "shebang" line) specifying "rexx".
@end itemize

The following key mappings are defined:

@multitable {backspace  } {backward-delete-char-untabify}
@item @code{backspace}       @tab backward-delete-char-untabify
@item @code{return}          @tab rexx-indent-and-newline
@item @code{tab}             @tab rexx-indent-command
@item @code{C-c}             @tab << Prefix Command >>
@item @code{C-i}             @tab rexx-indent-command
@item @code{C-m}             @tab rexx-indent-and-newline
@item @code{C-c C-c}         @tab rexx-debug
@item @code{C-c C-p}         @tab rexx-find-matching-do
@end multitable

The following variables control indentation style:

@table @code

@item rexx-indent

The basic indentation for do-blocks.

@item rexx-end-indent 

The relative offset of the \"end\" statement. 0 places it in the same column
as the statements of the block. Setting it to the same value as rexx-indent
places the \"end\" under the do-line.

@item rexx-cont-indent

The indention for lines following \"then\", \"else\" and \",\" (continued)
lines.

@item rexx-tab-always-indent

Non-nil means TAB in REXX mode should always reindent the current line,
regardless of where in the line the point is when the TAB command is used.

@end table

If you have set @code{rexx-end-indent} to a nonzero value, you probably want
to remap @kbd{RETURN} to @code{rexx-indent-newline-indent}. It makes sure
that lines indents correctly when you press @kbd{RETURN}.

An extensive abbreviation table consisting of all the keywords of REXX are
supplied.  Expanded keywords are converted into upper case making it easier
to distinguish them.  To use this feature the buffer must be in
@code{abbrev-mode}. (See example below.)

Turning on REXX mode calls the value of the variable @code{rexx-mode-hook}
with no args, if that value is non-nil.

For example:

@example
  (setq rexx-mode-hook '(lambda ()
                          (setq rexx-indent 4)
                          (setq rexx-end-indent 4)
                          (setq rexx-cont-indent 4)
                          (local-set-key \"\\C-m\" 'rexx-indent-newline-indent)
                          (abbrev-mode 1)
                          ))
@end example

will make the END aligned with the DO/SELECT.  It will indent blocks and
IF-statements four steps and make sure that the END jumps into the correct
position when RETURN is pressed.  Finally it will use the abbrev table to
convert all REXX keywords into upper case.

To configure this package, type:

@example
  M-x customize-group RET rexx RET
@end example

@menu
* About REXX: about-rexx.
@end menu

@node about-rexx,  , rexx-mode, rexx-mode
@section About REXX

REXX is a programming language designed by Michael Cowlishaw of IBM UK
Laboratories.  Rexx is an acronym which stands for "Restructured Extended
Executor Language".  In Mike's own words: "REXX is a procedural language that
allows programs and algorithms to be written in a clear and structured way."

@node rpm-spec-mode, simula, rexx-mode, Top
@chapter Editing RPM Specification Files

This mode is used for editing specification files for building RPM packages.
It is automatically invoked for buffers visting any file ending with an
extension of @file{.spec?}  or @file{.specin}.

The mode much like C mode except for the syntax of comments.  It uses the
same keymap as C mode and has the same variables for customizing indentation.
It has its own abbrev table and its own syntax table. @xref{Top, CC Mode, ,
cc-mode, CC Mode Manual}., for details.

Turning on RPM spec mode calls the value of the variable
@code{rpm-spec-mode-hook} with no args, if that value is non-nil.

To configure this package, type:

@example
  M-x customize-group RET rpm-spec RET
@end example

@menu
* About RPM: about-rpm.
@end menu

@node about-rpm,  , rpm-spec-mode, rpm-spec-mode
@section About RPM

The RPM Package Manager (RPM) is a powerful command line driven package
management system capable of installing, uninstalling, verifying, querying,
and updating computer software packages. Each software package consists of an
archive of files along with information about the package like its version, a
description, and the like. There is also a related API ("Application Program
Interface"), permitting advanced developers to bypass 'shelling out' to a
command line, and to manage such transactions from within a native coding
language.

For more information, see @uref{http://www.rpm.org/}.

@node simula, sql, rpm-spec-mode, Top
@chapter Editing SIMULA 87 Code

This mode is used for editing SIMULA code.  It is NOT automatically
invoked for any particular file extension.  To invoke this mode while editing
a file, type @code{M-x simula-mode}.

The mode knows about Simula syntax and standard indentation commands.  It
also provides convenient abbrevs for Simula keywords.

The following key mappings are defined:

@multitable {C-c C-d  } {simula-forward-down-level}
@item @code{:}               @tab simula-electric-label
@item @code{tab}             @tab simula-indent-command
@item @code{C-c}             @tab << Prefix Command >>
@item @code{C-i}             @tab simula-indent-command
@item @code{C-c C-d}         @tab simula-forward-down-level
@item @code{C-c C-n}         @tab simula-next-statement
@item @code{C-c C-p}         @tab simula-previous-statement
@item @code{C-c C-u}         @tab simula-backward-up-level
@end multitable

The following variables controlling indentation style:

@table @code

@item simula-tab-always-indent
Non-nil means TAB in SIMULA mode should always reindent the current line,
regardless of where in the line point is when the TAB command is used.

@item simula-indent-level
Indentation of SIMULA statements with respect to containing block.

@item simula-substatement-offset
Extra indentation after DO, THEN, ELSE, WHEN and OTHERWISE.

@item simula-continued-statement-offset
Extra indentation for lines not starting a statement or substatement,
e.g. a nested FOR-loop.  If value is a list, each line in a multiple-
line continued statement will have the car of the list extra indentation
with respect to the previous line of the statement.

@item simula-label-offset -4711
Offset of SIMULA label lines relative to usual indentation.

@item simula-if-indent '(0 . 0)
Extra indentation of THEN and ELSE with respect to the starting IF.
Value is a cons cell, the car is extra THEN indentation and the cdr
extra ELSE indentation.  IF after ELSE is indented as the starting IF.

@item simula-inspect-indent '(0 . 0)
Extra indentation of WHEN and OTHERWISE with respect to the
corresponding INSPECT.  Value is a cons cell, the car is
extra WHEN indentation and the cdr extra OTHERWISE indentation.

@item simula-electric-indent nil
If this variable is non-nil, `simula-indent-line'
will check the previous line to see if it has to be reindented.

@item simula-abbrev-keyword 'upcase
Determine how SIMULA keywords will be expanded.  Value is one of
the symbols `upcase', `downcase', `capitalize', (as in) `abbrev-table',
or nil if they should not be changed.

@item simula-abbrev-stdproc 'abbrev-table
Determine how standard SIMULA procedure and class names will be
expanded. Value is one of the symbols `upcase', `downcase', `capitalize',
(as in) `abbrev-table', or nil if they should not be changed.

@end table

Turning on SIMULA mode calls the value of the variable
@code{simula-mode-hook} with no arguments, if that value is non-nil.

Warning: @code{simula-mode-hook} should not read in an abbrev file without
calling the function @code{simula-install-standard-abbrevs} afterwards,
preferably not at all.

To configure this package, type:

@example
  M-x customize-group RET simula RET
@end example

@menu
* About SIMULA: about-simula.
@end menu

@node about-simula,  , simula, simula
@section About SIMULA

The SIMULA programming language was designed and built by Ole-Johan Dahl and
Kristen Nygaard at the Norwegian Computing Center (NCC) in Olslo between 1962
and 1967. It was originally designed and implemented as a language for
discrete event simulation, but was later expended and reimplemented as a full
sacle general purpose programming language.

For more information, see
@uref{http://www.engin.umd.umich.edu/CIS/course.des/cis400/simula/simula.html}.

@node sql, tcl, simula, Top
@chapter Specialized Mode for SQL Interpreters

This package provides a @code{sql-mode} and a @code{sql-interactive-mode}.
The goals were two simple modes providing syntactic hilighting.  The
interactive mode had to provide a command-line history; the other mode had to
provide "send region/buffer to SQL interpreter" functions.  "simple" in this
context means easy to use, easy to maintain and little or no bells and
whistles.

@code{sql-interactive-mode} is used to interact with a SQL interpreter
process in a SQLi buffer (usually called `*SQL*').  The SQLi buffer
is created by calling a SQL interpreter-specific entry function.  Do
@emph{not} call @code{sql-interactive-mode} by itself.

The list of currently supported interpreters and the corresponding entry
function used to create the SQLi buffers is shown with @kbd{M-x sql-help}.

Since @code{sql-interactive-mode} is built on top of the general
command-interpreter-in-a-buffer mode (comint mode), it shares a common base
functionality, and a common set of bindings, with all modes derived from
comint mode.  This makes these modes easier to use.

@code{sql-mode} can be used to keep editing SQL statements.  The SQL
statements can be sent to the SQL process in the SQLi buffer.

For documentation on the functionality provided by comint mode, and the hooks
available for customizing it, see the file @file{comint.el}.

Hint for newbies: take a look at @code{dabbrev-expand}, @code{abbrev-mode},
and @code{imenu-add-menubar-index}.

To configure this package, type:

@example
  M-x customize-group RET SQL RET
@end example

@node tcl, teco, sql, Top
@chapter Editing Tcl Code

This mode is used to edit Tcl code.  The mode is automatically invoked
for buffers visiting the following types of files:

@itemize @bullet
@item any file ending with an extension of @file{.tcl} or @file{.exp}.  
@item any file that has an interpretor line (the "shebang" line) specifying
"scope", "wish", "tcl", "tclsh", or "expect".
@end itemize

The mode provides the following capabilities:

@itemize @bullet
@item Expression and list commands understand all Tcl brackets.
@item Tab indents for Tcl code.
@item Paragraphs are separated by blank lines only.
@item Delete converts tabs to spaces as it moves back.
@end itemize

The variables controlling indentation style are:

@table @code

@item tcl-indent-level
Indentation of Tcl statements within surrounding block.

@item tcl-continued-indent-level
Indentation of continuation line relative to first line of command.

@end table

The variables controlling user interaction with mode (see variable
documentation for details) are:

@table @code

@item tcl-tab-always-indent
Controls action of TAB key.

@item tcl-auto-newline
Non-nil means automatically newline before and after braces, brackets,
and semicolons inserted in Tcl code.

@item tcl-electric-hash-style
Controls action of `#' key.

@item tcl-use-hairy-comment-detector
If t, use more complicated, but slower, comment detector.
This variable is only used in Emacs 19.

@item tcl-use-smart-word-finder
If not nil, use a smarter, Tcl-specific way to find the current
word when looking up help on a Tcl command.

@end table

Turning on Tcl mode calls the value of the variable @code{tcl-mode-hook} with
no args, if that value is non-nil.  Read the documentation for
@code{tcl-mode-hook} to see what kinds of interesting hook functions already
exist.

The following key mappings are defined:

@multitable {M-backspace  } {backward-delete-char-untabify}
@item @code{#}                @tab tcl-electric-hash
@item @code{;}                @tab tcl-electric-char
@item @code{[}                @tab tcl-electric-char
@item @code{]}                @tab tcl-electric-char
@item @code{@{}               @tab tcl-electric-char
@item @code{@}}               @tab tcl-electric-brace
@item @code{delete}           @tab backward-delete-char-untabify
@item @code{tab}              @tab tcl-indent-command
@item @code{C-c}              @tab << Prefix Command >>
@item @code{C-i}              @tab tcl-indent-command
@item @code{M-;}              @tab tcl-indent-for-comment
@item @code{M-backspace}      @tab tcl-mark-defun
@item @code{M-C-a}            @tab tcl-beginning-of-defun
@item @code{M-C-e}            @tab tcl-end-of-defun
@item @code{M-C-h}            @tab tcl-mark-defun
@item @code{M-C-q}            @tab indent-tcl-exp
@item @code{M-C-x}            @tab tcl-eval-defun
@item @code{C-c tab}          @tab tcl-help-on-word
@item @code{C-c C-b}          @tab tcl-submit-bug-report
@item @code{C-c C-c}          @tab comment-region
@item @code{C-c C-f}          @tab tcl-load-file
@item @code{C-c C-i}          @tab tcl-help-on-word
@item @code{C-c C-s}          @tab switch-to-tcl
@item @code{C-c C-t}          @tab inferior-tcl
@item @code{C-c C-v}          @tab tcl-eval-defun
@item @code{C-c C-x}          @tab tcl-eval-region
@end multitable

To configure this package, type:

@example
  M-x customize-group RET tcl RET
@end example

@menu
* About Tcl: about-tcl.
@end menu

@node about-tcl,  , tcl, tcl
@section About Tcl

Tcl (Tool Command Language) is used by over half a million developers
worldwide and has become a critical component in thousands of
corporations. It has a simple and programmable syntax and can be either used
as a standalone application or embedded in application programs. Best of all,
Tcl is open source so it's completely free.

Tk is a graphical user interface toolkit that makes it possible to create
powerful GUIs incredibly quickly. It proved so popular that it now ships with
all distributions of Tcl.

For more information, see @uref{http://www.tcl.tk/software/tcltk/}.

@node teco, uil-mode, tcl, Top
@chapter Teco Interpreter

This package implements a Teco Interpreter.

To configure this package please view the source code.  This can be done by
typing @kbd{C-x 4 l teco}.

@node uil-mode, verilog-mode, teco, Top
@chapter Editing Motif UIL Code

This mode is used to edit Motif UIL files.  It is automatically invoked
for buffers visting any file ending with an extension of @file{.uil}.

This mode is much like C mode except for the syntax of comments.  It uses the
same keymap as C mode and has the same variables for customizing indentation.
It has its own abbrev table and its own syntax table. @xref{Top, CC Mode, ,
cc-mode, CC Mode Manual}., for details.

Turning on uilmode calls the value of the variable @code{uil-mode-hook} with
no args, if that value is non-nil.

To configure this package please view the source code.  This can be done by
typing @kbd{C-x 4 l uil-mode}.

@menu
* About UIL: about-uil.
@end menu

@node about-uil,  , uil-mode, uil-mode
@section About UIL

The Motif user interface language (UIL) is a specification language for
describing the initial state of a Motif application's user interface.

@node verilog-mode, vrml-mode, uil-mode, Top
@chapter Editing Verilog HDL Source

This mode is used to edit Verilog source files.  It is automatically invoked
for buffers visting any file ending with one of the following extensions:
@file{.vh?}, @file{.dv}, @file{.vlog}, and @file{.verilog}.

The mode provides the following features:

@itemize @bullet
@item NEWLINE, TAB indents for Verilog code.
@item Delete converts tabs to spaces as it moves back.
@item Supports highlighting.
@end itemize

The variables controlling indentation/edit style are:

@table @code

@item verilog-indent-level
Indentation of Verilog statements with respect to containing block.

@item verilog-indent-level-module
Absolute indentation of Module level Verilog statements.
Set to 0 to get initial and always statements lined up
on the left side of your screen.

@item  verilog-indent-level-declaration
Indentation of declarations with respect to containing block.
Set to 0 to get them list right under containing block.

@item verilog-indent-level-behavioral
Indentation of first begin in a task or function block
Set to 0 to get such code to lined up underneath the task or function keyword

@item verilog-indent-level-directive
Indentation of `ifdef/`endif blocks

@item `verilog-cexp-indent
Indentation of Verilog statements broken across lines i.e.:
@example
  if (a)
   begin
@end example

@item verilog-case-indent
Indentation for case statements.

@item verilog-auto-newline
Non-nil means automatically newline after semicolons and the punctuation
mark after an end.

@item verilog-auto-indent-on-newline
Non-nil means automatically indent line after newline

@item verilog-tab-always-indent
Non-nil means TAB in Verilog mode should always reindent the current line,
regardless of where in the line point is when the TAB command is used.

@item verilog-indent-begin-after-if
Non-nil means to indent begin statements following a preceding
if, else, while, for and repeat statements, if any.  otherwise,
the begin is lined up with the preceding token.  If t, you get:
@example
  if (a)
     begin // amount of indent based on `verilog-cexp-indent'
@end example

otherwise you get:
@example
  if (a)
  begin
@end example

@item verilog-auto-endcomments
Non-nil means a comment /* ... */ is set after the ends which ends
cases, tasks, functions and modules.
The type and name of the object will be set between the braces.

@item verilog-minimum-comment-distance
Minimum distance (in lines) between begin and end required before a comment
will be inserted.  Setting this variable to zero results in every
end acquiring a comment; the default avoids too many redundant
comments in tight quarters.

@item verilog-auto-lineup
List of contexts where auto lineup of :'s or ='s should be done.

@end table

Turning on Verilog mode calls the value of the variable
@code{verilog-mode-hook} with no args, if that value is non-nil.

Other useful functions are:

@table @code

@item verilog-complete-word
complete word with appropriate possibilities (functions, verilog keywords...)

@item verilog-comment-region
Put marked area in a comment, fixing nested comments.

@item verilog-uncomment-region
Uncomment an area commented with @code{verilog-comment-region}.

@item verilog-insert-block
insert begin ... end;

@item verilog-star-comment
insert /* ... */

@item verilog-mark-defun
Mark function.

@item erilog-beg-of-defun
Move to beginning of current function.

@item verilog-end-of-defun
Move to end of current function.

@item verilog-label-be
Label matching begin ... end, fork ... join and case ... endcase statements

@item verilog-sk-always
Insert a always @@(AS) begin .. end block

@item verilog-sk-begin
Insert a begin .. end block

@item verilog-sk-case
Insert a case block, prompting for details

@item verilog-sk-else
Insert an else begin .. end block

@item verilog-sk-for
Insert a for (...) begin .. end block, prompting for details

@item verilog-sk-generate
Insert a generate .. endgenerate block

@item verilog-sk-header
Insert a nice header block at the top of file

@item verilog-sk-initial
Insert an initial begin .. end block

@item verilog-sk-fork
Insert a fork begin .. end .. join block

@item verilog-sk-module
Insert a module .. (/*AUTOARG*/);.. endmodule block

@item verilog-sk-primitive
Insert a primitive .. (.. );.. endprimitive block

@item verilog-sk-repeat
Insert a repeat (..) begin .. end block

@item verilog-sk-specify
Insert a specify .. endspecify block

@item verilog-sk-task
Insert a task .. begin .. end endtask block

@item verilog-sk-while
Insert a while (...) begin .. end block, prompting for details

@item verilog-sk-casex
Insert a casex (...) item: begin.. end endcase block, prompting for details

@item verilog-sk-casez
Insert a casez (...) item: begin.. end endcase block, prompting for details

@item verilog-sk-if
Insert an if (..) begin .. end block

@item verilog-sk-else-if
Insert an else if (..) begin .. end block

@item verilog-sk-comment
Insert a comment block

@item verilog-sk-assign
Insert an assign .. = ..; statement

@item verilog-sk-function
Insert a function .. begin .. end endfunction block

@item verilog-sk-input
Insert an input declaration, prompting for details

@item verilog-sk-output
Insert an output declaration, prompting for details

@item verilog-sk-state-machine
Insert a state machine definition, prompting for details!

@item verilog-sk-inout
Insert an inout declaration, prompting for details

@item verilog-sk-wire
Insert a wire declaration, prompting for details

@item verilog-sk-reg
Insert a register declaration, prompting for details"

@end table

To configure this package, type:

@example
  M-x customize-group RET verilog-mode RET
@end example

@menu
* About Verilog: about-verilog.
@end menu

@node about-verilog,  , verilog-mode, verilog-mode
@section About Verilog

Verilog HDL is a hardware description language used to design and document
electronic systems. Verilog HDL allows designers to design at various levels
of abstraction. It is the most widely used HDL with a user community of more
than 50,000 active designers.

For more information, see @uref{http://www.verilog.com/}.

@node vrml-mode, XEmacs License, verilog-mode, Top
@chapter Editing VRML (.wrl) Files

This mode is used for editing VRML files.  It is automatically invoked for
buffers visting any file ending with an extension of @file{.wrl}.

The mode has the following features:

@itemize @bullet
@item Expression and list commands understand all VRML brackets.
@item Tab indents for VRML code.
@item Paragraphs are separated by blank lines only.
@item Delete converts tabs to spaces as it moves back.

@end itemize

The variables controlling indentation style are:

@table @code

@item vrml-indent-level
Indentation of VRML statements within surrounding block.

@end table

The variables controlling user interaction with mode (see variable
documentation for details) are:

@table @code

@item vrml-tab-always-indent
Controls action of TAB key.

@item vrml-auto-newline
Non-nil means automatically newline before and after braces
inserted in VRML code.

@end table

Turning on VRML mode calls the value of the variable @code{vrml-mode-hook}
with no args, if that value is non-nil.  Read the documentation for
@code{vrml-mode-hook} to see what kinds of interesting hook functions already
exist.

To configure this package, type:

@example
  M-x customize-group RET vrml RET
@end example

@node XEmacs License,  , vrml-mode, Top
@chapter XEmacs License
@unnumbered GNU GENERAL PUBLIC LICENSE
@center Version 2, June 1991

@display
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@end display

@unnumberedsec Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software---to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

@iftex
@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@end iftex
@ifinfo
@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@end ifinfo

@enumerate 0
@item
This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The ``Program'', below,
refers to any such program or work, and a ``work based on the Program''
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term ``modification''.)  Each licensee is addressed as ``you''.

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

@item
You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

@item
You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

@enumerate a
@item
You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.

@item
You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.

@item
If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License.  (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
@end enumerate

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

@item
You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

@enumerate a
@item
Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,

@item
Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,

@item
Accompany it with the information you received as to the offer
to distribute corresponding source code.  (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
@end enumerate

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

@item
You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

@item
You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

@item
Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

@item
If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

@item
If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

@item
The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and ``any
later version'', you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

@item
If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

@iftex
@heading NO WARRANTY
@end iftex
@ifinfo
@center NO WARRANTY
@end ifinfo

@item
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW@.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE@.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU@.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

@item
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
@end enumerate

@iftex
@heading END OF TERMS AND CONDITIONS
@end iftex
@ifinfo
@center END OF TERMS AND CONDITIONS
@end ifinfo

@page
@unnumberedsec How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the ``copyright'' line and a pointer to where the full notice is found.

@smallexample
@var{one line to give the program's name and an idea of what it does.}
Copyright (C) 19@var{yy}  @var{name of author}

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE@.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@end smallexample

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

@smallexample
Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author}
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'.  This is free software, and you are welcome
to redistribute it under certain conditions; type `show c'
for details.
@end smallexample

The hypothetical commands @samp{show w} and @samp{show c} should show
the appropriate parts of the General Public License.  Of course, the
commands you use may be called something other than @samp{show w} and
@samp{show c}; they could even be mouse-clicks or menu items---whatever
suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a ``copyright disclaimer'' for the program, if
necessary.  Here is a sample; alter the names:

@smallexample
@group
Yoyodyne, Inc., hereby disclaims all copyright
interest in the program `Gnomovision'
(which makes passes at compilers) written
by James Hacker.

@var{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
@end group
@end smallexample

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Library General
Public License instead of this License.
