aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLute Kamstra2005-04-29 13:02:54 +0000
committerLute Kamstra2005-04-29 13:02:54 +0000
commit010a33862de4caa0d9431ec2a4f07bf61ff76d1c (patch)
treeb625a5d3e2818054a7efb3382cd1343c0ae1ca5a
parentb67a4e9f6a914d59713d84b07e0189ccd45f9336 (diff)
downloademacs-010a33862de4caa0d9431ec2a4f07bf61ff76d1c.tar.gz
emacs-010a33862de4caa0d9431ec2a4f07bf61ff76d1c.zip
(Generic Modes): New node.
(Major Modes): Add it to the menu. (Derived Modes): Add "derived mode" to concept index.
-rw-r--r--lispref/modes.texi54
1 files changed, 54 insertions, 0 deletions
diff --git a/lispref/modes.texi b/lispref/modes.texi
index e0494d4e7d9..12c4493b36f 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -103,6 +103,8 @@ Fundamental mode. Rmail mode is a complicated and specialized mode.
103* Mode Help:: Finding out how to use a mode. 103* Mode Help:: Finding out how to use a mode.
104* Derived Modes:: Defining a new major mode based on another major 104* Derived Modes:: Defining a new major mode based on another major
105 mode. 105 mode.
106* Generic Modes:: Defining a simple major mode that supports
107 comment syntax and Font Lock mode.
106* Mode Hooks:: Hooks run at the end of major mode functions. 108* Mode Hooks:: Hooks run at the end of major mode functions.
107@end menu 109@end menu
108 110
@@ -798,6 +800,7 @@ mode.
798 800
799@node Derived Modes 801@node Derived Modes
800@subsection Defining Derived Modes 802@subsection Defining Derived Modes
803@cindex derived mode
801 804
802 It's often useful to define a new major mode in terms of an existing 805 It's often useful to define a new major mode in terms of an existing
803one. An easy way to do this is to use @code{define-derived-mode}. 806one. An easy way to do this is to use @code{define-derived-mode}.
@@ -860,6 +863,57 @@ Do not write an @code{interactive} spec in the definition;
860@code{define-derived-mode} does that automatically. 863@code{define-derived-mode} does that automatically.
861@end defmac 864@end defmac
862 865
866@node Generic Modes
867@subsection Generic Modes
868@cindex generic mode
869
870@dfn{Generic modes} are simple major modes with basic support for
871comment syntax and Font Lock mode. They are primarily useful for
872configuration files. To define a generic mode, use the macro
873@code{define-generic-mode}. See the file @file{generic-x.el} for some
874examples of the use of @code{define-generic-mode}.
875
876@defmac define-generic-mode mode comment-list keyword-list font-lock-list auto-mode-list function-list &optional docstring &rest custom-keyword-args
877This macro creates a new generic mode. The argument @var{mode} (an
878unquoted symbol) is the major mode command. The optional argument
879@var{docstring} is the documentation for the mode command. If you do
880not supply it, @code{define-generic-mode} uses a default documentation
881string instead.
882
883@var{comment-list} is a list in which each element is either a
884character, a string of one or two characters, or a cons cell. A
885character or a string is set up in the mode's syntax table as a
886``comment starter.'' If the entry is a cons cell, the @sc{car} is set
887up as a ``comment starter'' and the @sc{cdr} as a ``comment ender.''
888(Use @code{nil} for the latter if you want comments to end at the end
889of the line.) Note that the syntax table has limitations about what
890comment starters and enders are actually possible. @xref{Syntax
891Tables}.
892
893@var{keyword-list} is a list of keywords to highlight with
894@code{font-lock-keyword-face}. Each keyword should be a string.
895@var{font-lock-list} is a list of additional expressions to highlight.
896Each element of this list should have the same form as an element of
897@code{font-lock-keywords}. @xref{Search-based Fontification}.
898
899@var{auto-mode-list} is a list of regular expressions to add to the
900variable @code{auto-mode-alist}. These regular expressions are added
901when Emacs runs the macro expansion.
902
903@var{function-list} is a list of functions to call to do some
904additional setup. The mode command calls these functions just before
905it runs the mode hook.
906
907The optional @var{custom-keyword-args} are pairs of keywords and
908values to include in the generated @code{defcustom} form for the mode
909hook variable @code{@var{mode}-hook}. The default value for the
910@samp{:group} keyword is @var{mode} with the final @samp{-mode} (if
911any) removed. Don't use this default group name unless you have
912written a @code{defgroup} to define that group properly (@pxref{Group
913Definitions}). You can specify keyword arguments without specifying a
914docstring.
915@end defmac
916
863@node Mode Hooks 917@node Mode Hooks
864@subsection Mode Hooks 918@subsection Mode Hooks
865 919