changeset 102763:e81a0c5f14b1

(Major Mode Conventions): Note that specialness is inherited.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 28 Mar 2009 13:38:55 +0000
parents 35261e42ea66
children 17ee4b5315c3
files doc/lispref/modes.texi
diffstat 1 files changed, 20 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/doc/lispref/modes.texi	Sat Mar 28 13:37:36 2009 +0000
+++ b/doc/lispref/modes.texi	Sat Mar 28 13:38:55 2009 +0000
@@ -157,13 +157,13 @@
 changing major modes) won't delete it from the hook variable's local
 value.
 
-It is best to design your hook functions so that the order in which they
-are executed does not matter.  Any dependence on the order is ``asking
-for trouble.''  However, the order is predictable: normally,
+It is best to design your hook functions so that the order in which
+they are executed does not matter.  Any dependence on the order is
+asking for trouble.  However, the order is predictable: normally,
 @var{function} goes at the front of the hook list, so it will be
-executed first (barring another @code{add-hook} call).  If the optional
-argument @var{append} is non-@code{nil}, the new hook function goes at
-the end of the hook list and will be executed last.
+executed first (barring another @code{add-hook} call).  If the
+optional argument @var{append} is non-@code{nil}, the new hook
+function goes at the end of the hook list and will be executed last.
 
 @code{add-hook} can handle the cases where @var{hook} is void or its
 value is a single function; it sets or changes the value to a list of
@@ -231,11 +231,11 @@
   If the new mode is similar to an old one, it is often unwise to
 modify the old one to serve two purposes, since it may become harder
 to use and maintain.  Instead, copy and rename an existing major mode
-definition and alter the copy---or use @code{define-derived-mode} to
-define a @dfn{derived mode} (@pxref{Derived Modes}).  For example,
-Rmail Edit mode is a major mode that is very similar to Text mode
-except that it provides two additional commands.  Its definition is
-distinct from that of Text mode, but uses that of Text mode.
+definition and alter the copy---or use the @code{define-derived-mode}
+macro to define a @dfn{derived mode} (@pxref{Derived Modes}).  For
+example, Rmail Edit mode is a major mode that is very similar to 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 is convenient to use @code{define-derived-mode} with a @code{nil}
@@ -460,9 +460,9 @@
 The major mode command may start by calling some other major mode
 command (called the @dfn{parent mode}) and then alter some of its
 settings.  A mode that does this is called a @dfn{derived mode}.  The
-recommended way to define one is to use @code{define-derived-mode},
-but this is not required.  Such a mode should call the parent mode
-command inside a @code{delay-mode-hooks} form.  (Using
+recommended way to define one is to use the @code{define-derived-mode}
+macro, but this is not required.  Such a mode should call the parent
+mode command inside a @code{delay-mode-hooks} form.  (Using
 @code{define-derived-mode} does this automatically.)  @xref{Derived
 Modes}, and @ref{Mode Hooks}.
 
@@ -488,6 +488,12 @@
 @code{default-major-mode} is @code{nil}.  Modes such as Dired, Rmail,
 and Buffer List use this feature.
 
+The @code{define-derived-mode} macro automatically marks the derived
+mode as special if the parent mode is special.  The special mode
+@code{special-mode} provides a convenient parent for other special
+modes to inherit from; it sets @code{buffer-read-only} to @code{t},
+and does nothing else.
+
 @item
 If you want to make the new mode the default for files with certain
 recognizable names, add an element to @code{auto-mode-alist} to select