parsed.org
Setting Modes by xinu on Jan 15, 2005 02:52 PM

If you wish for a particular file to be handled with a mode that isn't already associated with its extension, you may put a header like this anywhere in the file:

-*- mode: outline; mode: auto-fill -*-

Alternatively, you can update your ~/.emacs to use modes based on file extension or filename. For example, to use html-mode for files ending in .tpl:

(setq auto-mode-alist
  (cons '("\\.tpl$" . html-mode) auto-mode-alist))

You can also configure Emacs to use a specific major and minor mode together for a given file extension. This example defines my-mode to load outline-mode (a major mode) and auto-fill-mode (a minor mode) for files ending in .foo:

(defun my-mode ()
  (outline-mode)
  (auto-fill-mode))

(setq auto-mode-alist
  (append '(("\\.foo$" . my-mode))
    auto-mode-alist))
configurationdot-emacseditorselispemacs
RSS