diff options
| author | Kim F. Storm | 2006-12-19 09:14:00 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-12-19 09:14:00 +0000 |
| commit | 5f3bef951920930c9c335c96dcd87cbbb3cf6d60 (patch) | |
| tree | d936162a7e9426dba1d72a6c909320c30db71499 | |
| parent | 10ffa2a1cefca36dd67ef7cf4dfa1e7b143e87d3 (diff) | |
| download | emacs-5f3bef951920930c9c335c96dcd87cbbb3cf6d60.tar.gz emacs-5f3bef951920930c9c335c96dcd87cbbb3cf6d60.zip | |
(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} | |||
| 102 | @vindex magic-mode-alist | 102 | @vindex magic-mode-alist |
| 103 | Sometimes the major mode is determined from the way the file's text | 103 | Sometimes the major mode is determined from the way the file's text |
| 104 | begins. The variable @code{magic-mode-alist} controls this. Its value | 104 | begins. The variable @code{magic-mode-alist} controls this. Its value |
| 105 | is a list of elements of this form: | 105 | is a list of elements of these forms: |
| 106 | 106 | ||
| 107 | @example | 107 | @example |
| 108 | (@var{regexp} . @var{mode-function}) | 108 | (@var{regexp} . @var{mode-function}) |
| 109 | (@var{match-function} . @var{mode-function}) | ||
| 109 | @end example | 110 | @end example |
| 110 | 111 | ||
| 111 | @noindent | 112 | @noindent |
| 112 | This looks like an element of @code{auto-mode-alist}, but it doesn't work | 113 | The first form looks like an element of @code{auto-mode-alist}, but it |
| 113 | the same: this @var{regexp} is matched against the text at the start | 114 | doesn't work the same: this @var{regexp} is matched against the text |
| 114 | of the buffer, not against the file name. @code{magic-mode-alist} | 115 | at the start of the buffer, not against the file name. Likewise, the |
| 115 | takes priority over @code{auto-mode-alist}. | 116 | second form calls @var{match-function} at the beginning of the buffer, |
| 117 | and if the function returns non-@code{nil}, the @var{mode-function} is | ||
| 118 | called. @code{magic-mode-alist} takes priority over | ||
| 119 | @code{auto-mode-alist}. | ||
| 116 | 120 | ||
| 117 | You can specify the major mode to use for editing a certain file by | 121 | You can specify the major mode to use for editing a certain file by |
| 118 | special text in the first nonblank line of the file. The | 122 | special text in the first nonblank line of the file. The |