GNU Info

Info Node: (emacs)Program Modes

(emacs)Program Modes


Next: Defuns Up: Programs
Enter node , (file) or (file)node

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

   Emacs has specialized major modes for various programming languages.
Note: Major Modes.  A programming language major mode typically
specifies the syntax of expressions, the customary rules for
indentation, how to do syntax highlighting for the language, and how to
find the beginning of a function definition.  It often customizes or
provides facilities for compiling and debugging programs as well.

   Ideally, Emacs should provide a major mode for each programming
language that you might want to edit; if it doesn't have a mode for
your favorite language, you can contribute one.  But often the mode for
one language can serve for other syntactically similar languages.  The
major mode for language L is called `L-mode', and you can select it by
typing `M-x L-mode <RET>'.  Note: Choosing Modes.

   The existing programming language major modes include Lisp, Scheme (a
variant of Lisp) and the Scheme-based DSSSL expression language, Ada,
Awk, C, C++, Delphi (Object Pascal), Fortran (free format and fixed
format), Icon, IDL (CORBA), IDLWAVE, Java, Metafont (TeX's companion
for font creation), Modula2, Objective-C, Octave, Pascal, Perl, Pike,
PostScript, Prolog, Simula, Tcl, and VHDL.  There is also a major mode
for makefiles, called Makefile mode.  An alternative mode for Perl is
called CPerl mode.  Modes are available for the scripting languages of
the common GNU and Unix shells, VMS DCL, and MS-DOS/MS-Windows `BAT'
files.  There are also major modes for editing various sorts of
configuration files.

   In most programming languages, indentation should vary from line to
line to illustrate the structure of the program.  So the major modes
for programming languages arrange for <TAB> to update the indentation
of the current line.  They also rebind <DEL> to treat a tab as if it
were the equivalent number of spaces; this lets you delete one column
of indentation without worrying whether the whitespace consists of
spaces or tabs.  Use `C-b C-d' to delete a tab character before point,
in these modes.

   Separate manuals are available for the modes for Ada (Note: Ada
Mode.), C/C++/Objective C/Java/Corba IDL (*note CC Mode:
(ccmode)Top.) and the IDLWAVE modes (Note: IDLWAVE.).

   Turning on a major mode runs a normal hook called the "mode hook",
which is the value of a Lisp variable.  Each major mode has a mode
hook, and the hook's name is always made from the mode command's name
by adding `-hook'.  For example, turning on C mode runs the hook
`c-mode-hook', while turning on Lisp mode runs the hook
`lisp-mode-hook'.  The purpose of the mode hook is to give you a place
to set up customizations for that major mode.  Note: Hooks.


automatically generated by info2www version 1.2.2.9