Clarify major mode switching
* doc/emacs/modes.texi (Major Modes): * doc/lispref/modes.texi (Modes, Major Modes): Explictly say that each buffer has exactly one major mode and can't be "turned off", only switched away from (Bug#25357).
This commit is contained in:
parent
fc38671988
commit
a2a2073933
2 changed files with 19 additions and 12 deletions
|
@ -66,7 +66,10 @@ process (@pxref{Interactive Shell}).
|
||||||
first visit a file or create a buffer (@pxref{Choosing Modes}). You
|
first visit a file or create a buffer (@pxref{Choosing Modes}). You
|
||||||
can explicitly select a new major mode by using an @kbd{M-x} command.
|
can explicitly select a new major mode by using an @kbd{M-x} command.
|
||||||
Take the name of the mode and add @code{-mode} to get the name of the
|
Take the name of the mode and add @code{-mode} to get the name of the
|
||||||
command to select that mode (e.g., @kbd{M-x lisp-mode} enters Lisp mode).
|
command to select that mode (e.g., @kbd{M-x lisp-mode} enters Lisp
|
||||||
|
mode). Since every buffer has exactly one major mode, there is no way
|
||||||
|
to ``turn off'' a major mode; instead you must switch to a different
|
||||||
|
one.
|
||||||
|
|
||||||
@vindex major-mode
|
@vindex major-mode
|
||||||
The value of the buffer-local variable @code{major-mode} is a symbol
|
The value of the buffer-local variable @code{major-mode} is a symbol
|
||||||
|
|
|
@ -7,11 +7,12 @@
|
||||||
@chapter Major and Minor Modes
|
@chapter Major and Minor Modes
|
||||||
@cindex mode
|
@cindex mode
|
||||||
|
|
||||||
A @dfn{mode} is a set of definitions that customize Emacs and can be
|
A @dfn{mode} is a set of definitions that customize Emacs behavior
|
||||||
turned on and off while you edit. There are two varieties of modes:
|
in useful ways. There are two varieties of modes: @dfn{minor modes},
|
||||||
@dfn{major modes}, which are mutually exclusive and used for editing
|
which provide features that users can turn on and off while editing;
|
||||||
particular kinds of text, and @dfn{minor modes}, which provide features
|
and @dfn{major modes}, which are used for editing or interacting with
|
||||||
that users can enable individually.
|
a particular kind of text. Each buffer has exactly one @dfn{major
|
||||||
|
mode} at a time.
|
||||||
|
|
||||||
This chapter describes how to write both major and minor modes, how to
|
This chapter describes how to write both major and minor modes, how to
|
||||||
indicate them in the mode line, and how they run hooks supplied by the
|
indicate them in the mode line, and how they run hooks supplied by the
|
||||||
|
@ -196,12 +197,15 @@ from the buffer-local hook list instead of from the global hook list.
|
||||||
@cindex major mode
|
@cindex major mode
|
||||||
|
|
||||||
@cindex major mode command
|
@cindex major mode command
|
||||||
Major modes specialize Emacs for editing particular kinds of text.
|
Major modes specialize Emacs for editing or interacting with
|
||||||
Each buffer has one major mode at a time. Every major mode is
|
particular kinds of text. Each buffer has exactly one major mode at a
|
||||||
associated with a @dfn{major mode command}, whose name should end in
|
time. Every major mode is associated with a @dfn{major mode command},
|
||||||
@samp{-mode}. This command takes care of switching to that mode in the
|
whose name should end in @samp{-mode}. This command takes care of
|
||||||
current buffer, by setting various buffer-local variables such as a
|
switching to that mode in the current buffer, by setting various
|
||||||
local keymap. @xref{Major Mode Conventions}.
|
buffer-local variables such as a local keymap. @xref{Major Mode
|
||||||
|
Conventions}. Note that unlike minor modes there is no way to ``turn
|
||||||
|
off'' a major mode, instead the buffer must be switched to a different
|
||||||
|
one.
|
||||||
|
|
||||||
The least specialized major mode is called @dfn{Fundamental mode},
|
The least specialized major mode is called @dfn{Fundamental mode},
|
||||||
which has no mode-specific definitions or variable settings.
|
which has no mode-specific definitions or variable settings.
|
||||||
|
|
Loading…
Add table
Reference in a new issue