How do I make Emacs use a certain major mode for certain files?
===============================================================
If you want to use a certain mode FOO for all files whose names end
with the extension `.BAR', this will do it for you:
(setq auto-mode-alist (cons '("\\.BAR\\'" . FOO-mode) auto-mode-alist))
Otherwise put this somewhere in the first line of any file you want
to edit in the mode FOO (in the second line, if the first line begins
with `#!'):
-*- FOO -*-
Beginning with Emacs 19, the variable `interpreter-mode-alist'
specifies which mode to use when loading a shell script. (Emacs
determines which interpreter you're using by examining the first line of
the script.) This feature only applies when the file name doesn't
indicate which mode to use. Use `C-h v' (or `M-x describe-variable')
on `interpreter-mode-alist' to learn more.