(xemacs.info)Program Modes


Next: Lists Prev: Programs Up: Programs
Enter node , (file) or (file)node

21.1 Major Modes for Programming Languages
==========================================

Emacs has several major modes (Note: Major Modes) to support
programming languages. These major modes will typically understand
language syntax, provide automatic indentation features, syntax based
highlighting of text, and will often provide interfaces to the
programming environment to assist in compiling, executing and debugging
programs.

   A language mode exist when someone decides to take the trouble to
write it. At this time many widely used programming languages are
supported by XEmacs. Examples include Ada, Awk, C, C++, CORBA (IDL),
Fortran, Java, Lisp, Modula 2, Objective-C, Perl, Pike, Prolog, Python,
Ruby, Scheme, Simula, SQL, Tcl, Unix Shell scripts, and VHDL. Some of
these language have seperate manuals, and some times more than one mode
may be available for a language.  For example, there are several
variants of Lisp mode, which differ in the way they interface to Lisp
execution.  Note: Lisp Modes.

   Major modes for programming language support are distributed in
optional XEmacs packages (Note: Packages) that must be installed
before use. A notable exception to this rule is that a Lisp Mode is
integral to XEmacs. The Programming Mode Package (`prog-modes')
contains many such modes. Some languages are supported by packages of
their own; prominent examples of such packages include `cc-mode' for C,
C++, Java, Objective C etc., `python-modes' for Python, and `scheme'
for Scheme.

   For a language named LANG the major mode for the language will
typically be named `LANG-mode'.  For example, the mode for C is called
`c-mode', that for Bourne shell scripts is called `sh-mode' and so on.
These modes will invoke the functions listed in the corresponding hook
variables as a last step. Note: Mode Hooks.

   A mode can be invoked by typing `M-x LANG-mode <RET>'. However this
step is not normally required. If the package for a language mode is
installed XEmacs usually knows when to automatically invoke the mode.
This is normally done based on examining the file name to determine the
language. Note: Choosing Modes.

   Each of the programming language modes defines the <TAB> key to run
an indentation function that knows the indentation conventions of that
language and updates the current line's indentation accordingly.  <LFD>
is normally defined to do <RET> followed by <TAB>; thus it, too,
indents in a mode-specific fashion.

   In most programming languages, indentation is likely to vary from
line to line.  So the major modes for those languages rebind <DEL> to
treat a tab as if it were the equivalent number of spaces (using the
command `backward-delete-char-untabify').  This makes it possible to
rub out indentation one column at a time without worrying whether it is
made up of spaces or tabs.  In these modes, use `C-b C-d' to delete a
tab character before point.

   Programming language modes define paragraphs to be separated only by
blank lines, so that the paragraph commands remain useful.  Auto Fill
mode, if enabled in a programming language major mode, indents the new
lines which it creates.


automatically generated by info2www version 1.2.2.9