98 |
@var{mode-function}, Emacs discards the suffix that matched |
@var{mode-function}, Emacs discards the suffix that matched |
99 |
@var{regexp} and searches the list again for another match. |
@var{regexp} and searches the list again for another match. |
100 |
|
|
101 |
|
@vindex magic-mode-alist |
102 |
|
Sometimes the major mode is determined from the way the file's text |
103 |
|
begins. The variable @code{magic-mode-alist} controls this. Its value |
104 |
|
is a list of elements of this form: |
105 |
|
|
106 |
|
@example |
107 |
|
(@var{regexp} . @var{mode-function}) |
108 |
|
@end example |
109 |
|
|
110 |
|
@noindent |
111 |
|
This looks like an element of @code{auto-mode-alist}, but it doesn't work |
112 |
|
the same: this @var{regexp} is matched against the text at the start |
113 |
|
of the buffer, not against the file name. @code{magic-mode-alist} |
114 |
|
takes priority over @code{auto-mode-alist}. |
115 |
|
|
116 |
You can specify the major mode to use for editing a certain file by |
You can specify the major mode to use for editing a certain file by |
117 |
special text in the first nonblank line of the file. The |
special text in the first nonblank line of the file. The |
118 |
mode name should appear in this line both preceded and followed by |
mode name should appear in this line both preceded and followed by |