aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-03-28 13:38:55 +0000
committerChong Yidong2009-03-28 13:38:55 +0000
commit41633740578d28ef2e2f7322805781b979986321 (patch)
tree6c005eff16b4d818bdabeac86493b576c870aa2f
parent3c25a5a986380999e367134756efe2b71553fa70 (diff)
downloademacs-41633740578d28ef2e2f7322805781b979986321.tar.gz
emacs-41633740578d28ef2e2f7322805781b979986321.zip
(Major Mode Conventions): Note that specialness is inherited.
-rw-r--r--doc/lispref/modes.texi34
1 files changed, 20 insertions, 14 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 3547dd3e304..4fa843e6743 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -157,13 +157,13 @@ If @var{function} has a non-@code{nil} property
157changing major modes) won't delete it from the hook variable's local 157changing major modes) won't delete it from the hook variable's local
158value. 158value.
159 159
160It is best to design your hook functions so that the order in which they 160It is best to design your hook functions so that the order in which
161are executed does not matter. Any dependence on the order is ``asking 161they are executed does not matter. Any dependence on the order is
162for trouble.'' However, the order is predictable: normally, 162asking for trouble. However, the order is predictable: normally,
163@var{function} goes at the front of the hook list, so it will be 163@var{function} goes at the front of the hook list, so it will be
164executed first (barring another @code{add-hook} call). If the optional 164executed first (barring another @code{add-hook} call). If the
165argument @var{append} is non-@code{nil}, the new hook function goes at 165optional argument @var{append} is non-@code{nil}, the new hook
166the end of the hook list and will be executed last. 166function goes at the end of the hook list and will be executed last.
167 167
168@code{add-hook} can handle the cases where @var{hook} is void or its 168@code{add-hook} can handle the cases where @var{hook} is void or its
169value is a single function; it sets or changes the value to a list of 169value is a single function; it sets or changes the value to a list of
@@ -231,11 +231,11 @@ writing a minor mode, which is often difficult).
231 If the new mode is similar to an old one, it is often unwise to 231 If the new mode is similar to an old one, it is often unwise to
232modify the old one to serve two purposes, since it may become harder 232modify the old one to serve two purposes, since it may become harder
233to use and maintain. Instead, copy and rename an existing major mode 233to use and maintain. Instead, copy and rename an existing major mode
234definition and alter the copy---or use @code{define-derived-mode} to 234definition and alter the copy---or use the @code{define-derived-mode}
235define a @dfn{derived mode} (@pxref{Derived Modes}). For example, 235macro to define a @dfn{derived mode} (@pxref{Derived Modes}). For
236Rmail Edit mode is a major mode that is very similar to Text mode 236example, Rmail Edit mode is a major mode that is very similar to Text
237except that it provides two additional commands. Its definition is 237mode except that it provides two additional commands. Its definition
238distinct from that of Text mode, but uses that of Text mode. 238is distinct from that of Text mode, but uses that of Text mode.
239 239
240 Even if the new mode is not an obvious derivative of any other mode, 240 Even if the new mode is not an obvious derivative of any other mode,
241it is convenient to use @code{define-derived-mode} with a @code{nil} 241it is convenient to use @code{define-derived-mode} with a @code{nil}
@@ -460,9 +460,9 @@ and then runs the normal hook @code{after-change-major-mode-hook}.
460The major mode command may start by calling some other major mode 460The major mode command may start by calling some other major mode
461command (called the @dfn{parent mode}) and then alter some of its 461command (called the @dfn{parent mode}) and then alter some of its
462settings. A mode that does this is called a @dfn{derived mode}. The 462settings. A mode that does this is called a @dfn{derived mode}. The
463recommended way to define one is to use @code{define-derived-mode}, 463recommended way to define one is to use the @code{define-derived-mode}
464but this is not required. Such a mode should call the parent mode 464macro, but this is not required. Such a mode should call the parent
465command inside a @code{delay-mode-hooks} form. (Using 465mode command inside a @code{delay-mode-hooks} form. (Using
466@code{define-derived-mode} does this automatically.) @xref{Derived 466@code{define-derived-mode} does this automatically.) @xref{Derived
467Modes}, and @ref{Mode Hooks}. 467Modes}, and @ref{Mode Hooks}.
468 468
@@ -488,6 +488,12 @@ in Funny mode should not inherit Funny mode, in case
488@code{default-major-mode} is @code{nil}. Modes such as Dired, Rmail, 488@code{default-major-mode} is @code{nil}. Modes such as Dired, Rmail,
489and Buffer List use this feature. 489and Buffer List use this feature.
490 490
491The @code{define-derived-mode} macro automatically marks the derived
492mode as special if the parent mode is special. The special mode
493@code{special-mode} provides a convenient parent for other special
494modes to inherit from; it sets @code{buffer-read-only} to @code{t},
495and does nothing else.
496
491@item 497@item
492If you want to make the new mode the default for files with certain 498If you want to make the new mode the default for files with certain
493recognizable names, add an element to @code{auto-mode-alist} to select 499recognizable names, add an element to @code{auto-mode-alist} to select