@c -*-texinfo-*-
@c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998 Free Software Foundation, Inc.
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Free Software Foundation, Inc.
@c See the file elisp.texi for copying conditions.
@setfilename ../info/modes
@node Modes, Documentation, Keymaps, Top
Text mode except that it provides two additional commands. Its
definition is distinct from that of Text mode, but uses that of Text mode.
+ Even if the new mode is not an obvious derivative of any other mode,
+it can be convenient to define it as a derivative of
+@code{fundamental-mode}, so that @code{define-derived-mode} can
+automatically enforce the most important coding conventions for you.
+
Rmail Edit mode offers an example of changing the major mode
temporarily for a buffer, so it can be edited in a different way (with
ordinary Emacs commands rather than Rmail commands). In such cases, the
mode specification error}, followed by the original error message.
@end deffn
-@defopt enable-local-variables
-This variable controls processing of local variables lists in files
-being visited. A value of @code{t} means process the local variables
-lists unconditionally; @code{nil} means ignore them; anything else means
-ask the user what to do for each file. The default value is @code{t}.
-@end defopt
-
-@defvar ignored-local-variables
-This variable holds a list of variables that should not be
-set by a file's local variables list. Any value specified
-for one of these variables is ignored.
-@end defvar
-
-In addition to this list, any variable whose name has a non-@code{nil}
-@code{risky-local-variable} property is also ignored.
-
-@defopt enable-local-eval
-This variable controls processing of @samp{Eval:} in local variables
-lists in files being visited. A value of @code{t} means process them
-unconditionally; @code{nil} means ignore them; anything else means ask
-the user what to do for each file. The default value is @code{maybe}.
-@end defopt
-
@defun set-auto-mode
@cindex visited file mode
This function selects the major mode that is appropriate for the
not indicate which major mode to use.
@end defvar
-@defun hack-local-variables &optional force
-This function parses, and binds or evaluates as appropriate, any local
-variables specified by the contents of the current buffer.
-
-The handling of @code{enable-local-variables} documented for
-@code{normal-mode} actually takes place here. The argument @var{force}
-usually comes from the argument @var{find-file} given to
-@code{normal-mode}.
-@end defun
-
@node Mode Help
@subsection Getting Help about a Major Mode
@cindex mode help
@menu
* Minor Mode Conventions:: Tips for writing a minor mode.
* Keymaps and Minor Modes:: How a minor mode can have its own keymap.
-* Easy-Mmode:: A convenient facility for defining minor modes.
+* Defining Minor Modes:: A convenient facility for defining minor modes.
@end menu
@node Minor Mode Conventions
@kbd{@}}, @kbd{<}, @kbd{>}, @kbd{:}, and @kbd{;}. (Those few punctuation
characters are reserved for major modes.)
-@node Easy-Mmode
-@subsection Easy-Mmode
+@node Defining Minor Modes
+@subsection Defining Minor Modes
- The easy-mmode package provides a convenient way of implementing a
-mode in one self-contained definition. It currently supports only
+ The macro @code{define-minor-mode} offers a convenient way of
+implementing a mode in one self-contained definition. It supports only
buffer-local minor modes, not global ones.
-@defmac easy-mmode-define-minor-mode mode doc &optional init-value mode-indicator keymap
-@tindex easy-mmode-define-minor-mode
+@defmac define-minor-mode mode doc &optional init-value mode-indicator keymap body...
+@tindex define-minor-mode
This macro defines a new minor mode whose name is @var{mode} (a symbol).
+It defines a command named @var{mode} to toggle the minor
+mode, with @var{doc} as its documentation string. It also defines a
+variable named @var{mode}, which is set to @code{t} or @code{nil} by
+enabling or disabling the mode. The variable is initialized to
+@var{init-value}.
-This macro defines a command named @var{mode} which toggles the minor
-mode, and has @var{doc} as its documentation string.
-
-It also defines a variable named @var{mode}, which is set to @code{t} or
-@code{nil} by enabling or disabling the mode. The variable is
-initialized to @var{init-value}.
+The command named @var{mode} finishes by executing the @var{body} forms,
+if any, after it has performed the standard actions such as setting
+the variable named @var{mode}.
The string @var{mode-indicator} says what to display in the mode line
when the mode is enabled; if it is @code{nil}, the mode is not displayed
@end example
@end defmac
- Here is an example of using @code{easy-mmode-define-minor-mode}:
+ Here is an example of using @code{define-minor-mode}:
@smallexample
-(easy-mmode-define-minor-mode hungry-mode
+(define-minor-mode hungry-mode
"Toggle Hungry mode.
With no argument, this command toggles the mode.
Non-null prefix argument turns on the mode.
mode is enabled. It initializes the keymap with key bindings for
@kbd{C-@key{DEL}} and @kbd{C-M-@key{DEL}}.
+
+@findex easy-mmode-define-minor-mode
+ The name @code{easy-mmode-define-minor-mode} is an alias
+for this macro.
+
@node Mode Line Format
@section Mode Line Format
@cindex mode line
@code{mode-line-format} were changed to use them.
@defvar mode-line-mule-info
-@tindex mode-line-mule-info
This variable holds the value of the mode-line construct that displays
information about the language environment, buffer coding system, and
current input method. @xref{Non-ASCII Characters}.
@end defvar
@defvar mode-line-frame-identification
-@tindex mode-line-frame-identification
This variable identifies the current frame. The default value is
@code{" "} if you are using a window system which can show multiple
frames, or @code{"-%F "} on an ordinary terminal which shows only one
@group
" %[("
;; @r{@code{mode-line-mode-name} is a function}
- ;; @r{that copies the mode name and adds text
+ ;; @r{that copies the mode name and adds text}
;; @r{properties to make it mouse-sensitive.}
(:eval (mode-line-mode-name))
mode-line-process
@defvar header-line-format
This variable, local in every buffer, specifies how to display the
header line, for windows displaying the buffer. The format of the value
-is the same as for @code{mode-line-format} (@xref{Mode Line Data}).
+is the same as for @code{mode-line-format} (@pxref{Mode Line Data}).
@end defvar
@tindex default-header-line-format
@code{imenu-extract-index-name-function}:
@defvar imenu-prev-index-position-function
-If this variable is non-@code{nil}, its value should be a funtion that
+If this variable is non-@code{nil}, its value should be a function that
finds the next ``definition'' to put in the buffer index, scanning
backward in the buffer from point. It should return @code{nil} if it
doesn't find another ``definition'' before point. Otherwise it shuould
If @var{laxmatch} is non-@code{nil}, it means there should be no error
if there is no subexpression numbered @var{subexp} in @var{matcher}.
+Obviously, fontification of the subexpression numbered @var{subexp} will
+not occur. However, fontification of other subexpressions (and other
+regexps) will continue. If @var{laxmatch} is @code{nil}, and the
+specified subexpression is missing, then an error is signalled which
+terminates search-based fontification.
Here are some examples of elements of this kind, and what they do: