Before a major mode can be used to edit a buffer with it must be installed
in that buffer. The most straightforward method of doing this is simply
to invoke the mode's command which does this (i.e. c-mode).
It could be a bit annoying to have to this every time a new buffer is
created so the mode-alist variable allows major modes to be
installed automatically, when the buffer is opened.
major-mode variable is non-nil it defines the function to
call to install the mode; this function will be called.
Otherwise the mode-alist variable is searched; each regular
expression is matched against a string, when a match occurs the associated
function is called to install the mode.
The string matched against is defined by the first of the following
choices which is not nil or undefined.
Note that each match is case-insensitive.
When the init-mode function matches a regular expression to the
string it is using to find the mode for the buffer the associated mode
is installed.
For example, mode-alist could be,
(("\\.(c|h)$|^c(|-mode)$" . c-mode)
("\\.jl$|^lisp(|-mode)$" . lisp-mode)
("\\.(text|doc|txt|article|letter)$" . text-mode)
("^(text(|-mode)|(.*/|)draft)$" . text-mode)
("^indented-text(|-mode)$" . indented-text-mode)
("\\.[s]$|^asm(|-mode)$" . asm-mode)
("\\.[S]$|^asm-cpp(|-mode)$" . asm-cpp-mode)
("\\.texi(|nfo)|^texinfo(|-mode)$" . texinfo-mode))
Go to the first, previous, next, last section, table of contents.