# HG changeset patch # User Kim F. Storm # Date 1166519640 0 # Node ID 53b637f954f221801bd45f740a66b96745c97a11 # Parent 46f8a3942acbb54301ef4691a1e5f2297c8a392f (Choosing Modes): Describe match-function elements for magic-mode-alist. diff -r 46f8a3942acb -r 53b637f954f2 man/major.texi --- a/man/major.texi Tue Dec 19 09:04:30 2006 +0000 +++ b/man/major.texi Tue Dec 19 09:14:00 2006 +0000 @@ -102,17 +102,21 @@ @vindex magic-mode-alist Sometimes the major mode is determined from the way the file's text begins. The variable @code{magic-mode-alist} controls this. Its value -is a list of elements of this form: +is a list of elements of these forms: @example (@var{regexp} . @var{mode-function}) +(@var{match-function} . @var{mode-function}) @end example @noindent -This looks like an element of @code{auto-mode-alist}, but it doesn't work -the same: this @var{regexp} is matched against the text at the start -of the buffer, not against the file name. @code{magic-mode-alist} -takes priority over @code{auto-mode-alist}. +The first form looks like an element of @code{auto-mode-alist}, but it +doesn't work the same: this @var{regexp} is matched against the text +at the start of the buffer, not against the file name. Likewise, the +second form calls @var{match-function} at the beginning of the buffer, +and if the function returns non-@code{nil}, the @var{mode-function} is +called. @code{magic-mode-alist} takes priority over +@code{auto-mode-alist}. You can specify the major mode to use for editing a certain file by special text in the first nonblank line of the file. The