(emacs)Program Modes

Next: Lists Up: Programs

Major Modes for Programming Languages

   Emacs also has major modes for the programming languages Lisp, Scheme
(a variant of Lisp), Awk, C, C++, Perl, Icon, Fortran and Muddle
(another variant of Lisp).  There is also a major mode for makefiles,
called Makefile mode.

   Ideally, a major mode should be implemented for each programming
language that you might want to edit with Emacs; but often the mode for
one language can serve for other syntactically similar languages.  The
language modes that exist are those that someone decided to take the
trouble to write.

   There are several forms of Lisp mode, which differ in the way they
interface to Lisp execution.  Note: Executing Lisp.

   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.  For
example, in C mode TAB is bound to `c-indent-line'.  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.  Use `C-b C-d' to delete a tab character
before point, in these modes.

   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.

   Turning on a major mode runs a normal hook called the "mode hook",
which is the value of a Lisp variable.  For example, turning on C mode
runs the hook `c-mode-hook'.  Mode hook variables for other programming
language modes include `lisp-mode-hook', `emacs-lisp-mode-hook',
`lisp-interaction-mode-hook', `scheme-mode-hook' and
`muddle-mode-hook'.  Note: Hooks.

automatically generated by info2www