From 80ccc95f36342b5c840c0ce9cb4196094230668d Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 11 Apr 2005 16:39:49 +0000 Subject: [PATCH] (Choosing Modes): Document magic-mode-alist. --- man/major.texi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/man/major.texi b/man/major.texi index fa44b873031..28f0ff0f32f 100644 --- a/man/major.texi +++ b/man/major.texi @@ -98,6 +98,21 @@ the element has the form @code{(@var{regexp} @var{mode-function} @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 -- 2.39.2