diff options
author | Kim F. Storm <storm@cua.dk> | 2006-12-19 09:14:00 +0000 |
---|---|---|
committer | Kim F. Storm <storm@cua.dk> | 2006-12-19 09:14:00 +0000 |
commit | 5f3bef951920930c9c335c96dcd87cbbb3cf6d60 (patch) | |
tree | d936162a7e9426dba1d72a6c909320c30db71499 | |
parent | 10ffa2a1cefca36dd67ef7cf4dfa1e7b143e87d3 (diff) | |
download | emacs-5f3bef951920930c9c335c96dcd87cbbb3cf6d60.tar.gz |
(Choosing Modes): Describe match-function elements for
magic-mode-alist.
-rw-r--r-- | man/major.texi | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/man/major.texi b/man/major.texi index d1f3fbaeebf..e444965dd99 100644 --- a/man/major.texi +++ b/man/major.texi @@ -102,17 +102,21 @@ the element has the form @code{(@var{regexp} @var{mode-function} @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 |