# HG changeset patch # User Richard M. Stallman # Date 1113237589 0 # Node ID 9cc4be7413fb48e0dfb32d0608e3055a9641140d # Parent 67d24aba9eebef7d31849ff947625d5ddba7b19a (Choosing Modes): Document magic-mode-alist. diff -r 67d24aba9eeb -r 9cc4be7413fb man/major.texi --- a/man/major.texi Mon Apr 11 16:11:14 2005 +0000 +++ b/man/major.texi Mon Apr 11 16:39:49 2005 +0000 @@ -98,6 +98,21 @@ @var{mode-function}, Emacs discards the suffix that matched @var{regexp} and searches the list again for another match. +@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: + +@example +(@var{regexp} . @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}. + 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 mode name should appear in this line both preceded and followed by