diff options
| author | Chong Yidong | 2011-11-28 14:24:48 +0800 |
|---|---|---|
| committer | Chong Yidong | 2011-11-28 14:24:48 +0800 |
| commit | dc95a8b0de5b4c823f838a66d6cdc74ea5be2ccb (patch) | |
| tree | dd3d04bce069218964359b0fc718b79e36cd7057 | |
| parent | 1305621bc212d922c5ef8ee89d73ce7aae496b71 (diff) | |
| download | emacs-dc95a8b0de5b4c823f838a66d6cdc74ea5be2ccb.tar.gz emacs-dc95a8b0de5b4c823f838a66d6cdc74ea5be2ccb.zip | |
More updates to Modes chapter of Emacs manual.
* doc/emacs/modes.texi (Major Modes): Move major-mode variable doc here from
Choosing Modes. Document describe-mode. Document prog-mode-hook
and text-mode-hook. Add example of using hooks.
(Minor Modes): Document behavior of mode command calls from Lisp.
Note that setting the mode variable using Customize will DTRT.
(Choosing Modes): Add example of setting a minor mode using a
local variable.
| -rw-r--r-- | admin/FOR-RELEASE | 5 | ||||
| -rw-r--r-- | doc/emacs/ChangeLog | 10 | ||||
| -rw-r--r-- | doc/emacs/modes.texi | 255 |
3 files changed, 160 insertions, 110 deletions
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE index 01d488c97e3..9a6d7b68751 100644 --- a/admin/FOR-RELEASE +++ b/admin/FOR-RELEASE | |||
| @@ -170,7 +170,7 @@ entering.texi cyd | |||
| 170 | files.texi cyd | 170 | files.texi cyd |
| 171 | fixit.texi | 171 | fixit.texi |
| 172 | fortran-xtra.texi | 172 | fortran-xtra.texi |
| 173 | frames.texi | 173 | frames.texi cyd |
| 174 | glossary.texi | 174 | glossary.texi |
| 175 | help.texi cyd | 175 | help.texi cyd |
| 176 | indent.texi | 176 | indent.texi |
| @@ -182,6 +182,7 @@ major.texi | |||
| 182 | mark.texi cyd | 182 | mark.texi cyd |
| 183 | mini.texi | 183 | mini.texi |
| 184 | misc.texi | 184 | misc.texi |
| 185 | modes.texi cyd | ||
| 185 | msdog.texi | 186 | msdog.texi |
| 186 | msdog-xtra.texi | 187 | msdog-xtra.texi |
| 187 | mule.texi | 188 | mule.texi |
| @@ -197,7 +198,7 @@ text.texi | |||
| 197 | trouble.texi | 198 | trouble.texi |
| 198 | vc-xtra.texi | 199 | vc-xtra.texi |
| 199 | vc1-xtra.texi | 200 | vc1-xtra.texi |
| 200 | windows.texi | 201 | windows.texi cyd |
| 201 | xresources.texi | 202 | xresources.texi |
| 202 | 203 | ||
| 203 | ** Check the Lisp manual. | 204 | ** Check the Lisp manual. |
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 4f68215b7ff..23c022af600 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2011-11-28 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * modes.texi (Major Modes): Move major-mode variable doc here from | ||
| 4 | Choosing Modes. Document describe-mode. Document prog-mode-hook | ||
| 5 | and text-mode-hook. Add example of using hooks. | ||
| 6 | (Minor Modes): Document behavior of mode command calls from Lisp. | ||
| 7 | Note that setting the mode variable using Customize will DTRT. | ||
| 8 | (Choosing Modes): Add example of setting a minor mode using a | ||
| 9 | local variable. | ||
| 10 | |||
| 1 | 2011-11-27 Chong Yidong <cyd@gnu.org> | 11 | 2011-11-27 Chong Yidong <cyd@gnu.org> |
| 2 | 12 | ||
| 3 | * frames.texi (Creating Frames): Move frame parameter example to | 13 | * frames.texi (Creating Frames): Move frame parameter example to |
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi index 5a786be62cf..60636ce040f 100644 --- a/doc/emacs/modes.texi +++ b/doc/emacs/modes.texi | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | @c Free Software Foundation, Inc. | 3 | @c Free Software Foundation, Inc. |
| 4 | @c See file emacs.texi for copying conditions. | 4 | @c See file emacs.texi for copying conditions. |
| 5 | @node Modes, Indentation, International, Top | 5 | @node Modes, Indentation, International, Top |
| 6 | @chapter Editing Modes | 6 | @chapter Major and Minor Modes |
| 7 | 7 | ||
| 8 | Emacs contains many @dfn{editing modes}, each of which alters its | 8 | Emacs contains many @dfn{editing modes} that alter its basic |
| 9 | basic behavior in useful ways. These are divided into @dfn{major | 9 | behavior in useful ways. These are divided into @dfn{major modes} and |
| 10 | modes} and @dfn{minor modes}. | 10 | @dfn{minor modes}. |
| 11 | 11 | ||
| 12 | Major modes provide specialized facilities for working on a | 12 | Major modes provide specialized facilities for working on a |
| 13 | particular file type, such as a C source file (@pxref{Programs}), or a | 13 | particular file type, such as a C source file (@pxref{Programs}), or a |
| @@ -38,15 +38,8 @@ one another, and of the selected major mode. | |||
| 38 | 38 | ||
| 39 | Every buffer possesses a major mode, which determines the editing | 39 | Every buffer possesses a major mode, which determines the editing |
| 40 | behavior of Emacs while that buffer is current. The mode line | 40 | behavior of Emacs while that buffer is current. The mode line |
| 41 | normally shows the name of the current major mode, in parentheses. | 41 | normally shows the name of the current major mode, in parentheses |
| 42 | @xref{Mode Line}. | 42 | (@pxref{Mode Line}). |
| 43 | |||
| 44 | Usually, the major mode is automatically set by Emacs, when you | ||
| 45 | first visit a file or create a buffer. @xref{Choosing Modes}. You | ||
| 46 | can explicitly select a new major mode by using an @kbd{M-x} command. | ||
| 47 | Take the name of the mode and add @code{-mode} to get the name of the | ||
| 48 | command to select that mode. Thus, you can enter Lisp mode with | ||
| 49 | @kbd{M-x lisp-mode}. | ||
| 50 | 43 | ||
| 51 | The least specialized major mode is called @dfn{Fundamental mode}. | 44 | The least specialized major mode is called @dfn{Fundamental mode}. |
| 52 | This mode has no mode-specific redefinitions or variable settings, so | 45 | This mode has no mode-specific redefinitions or variable settings, so |
| @@ -55,73 +48,140 @@ user option variable is in its default state. | |||
| 55 | 48 | ||
| 56 | For editing text of a specific type that Emacs knows about, such as | 49 | For editing text of a specific type that Emacs knows about, such as |
| 57 | Lisp code or English text, you typically use a more specialized major | 50 | Lisp code or English text, you typically use a more specialized major |
| 58 | mode, such as Lisp mode or Text mode. Such major modes change the | 51 | mode, such as Lisp mode or Text mode. Most major modes fall into |
| 59 | meanings of some keys to become more specifically adapted to the | 52 | three major groups. The first group contains modes for normal text, |
| 60 | language being edited. The ones that are commonly changed are | 53 | either plain or with mark-up. It includes Text mode, HTML mode, SGML |
| 61 | @key{TAB}, @key{DEL}, and @kbd{C-j}. The prefix key @kbd{C-c} | 54 | mode, @TeX{} mode and Outline mode. The second group contains modes |
| 62 | normally contains mode-specific commands. In addition, the commands | 55 | for specific programming languages. These include Lisp mode (which |
| 63 | which handle comments use the mode to determine how comments are to be | 56 | has several variants), C mode, Fortran mode, and others. The third |
| 64 | delimited. Many major modes redefine the syntactical properties of | 57 | group consists of major modes that are not associated directly with |
| 65 | characters appearing in the buffer. | 58 | files; they are used in buffers created for specific purposes by |
| 66 | 59 | Emacs, such as Dired mode for buffers made by Dired (@pxref{Dired}), | |
| 67 | The major modes fall into three major groups. The first group | 60 | Message mode for buffers made by @kbd{C-x m} (@pxref{Sending Mail}), |
| 68 | contains modes for normal text, either plain or with mark-up. It | 61 | and Shell mode for buffers used to communicate with an inferior shell |
| 69 | includes Text mode, HTML mode, SGML mode, @TeX{} mode and Outline | 62 | process (@pxref{Interactive Shell}). |
| 70 | mode. The second group contains modes for specific programming | 63 | |
| 71 | languages. These include Lisp mode (which has several variants), C | 64 | Usually, the major mode is automatically set by Emacs, when you |
| 72 | mode, Fortran mode, and others. The remaining major modes are not | 65 | first visit a file or create a buffer (@pxref{Choosing Modes}). You |
| 73 | intended for use on users' files; they are used in buffers created for | 66 | can explicitly select a new major mode by using an @kbd{M-x} command. |
| 74 | specific purposes by Emacs, such as Dired mode for buffers made by | 67 | Take the name of the mode and add @code{-mode} to get the name of the |
| 75 | Dired (@pxref{Dired}), Message mode for buffers made by @kbd{C-x m} | 68 | command to select that mode. Thus, you can enter Lisp mode with |
| 76 | (@pxref{Sending Mail}), and Shell mode for buffers used for | 69 | @kbd{M-x lisp-mode}. |
| 77 | communicating with an inferior shell process (@pxref{Interactive | 70 | |
| 78 | Shell}). | 71 | @vindex major-mode |
| 79 | 72 | The value of the buffer-local variable @code{major-mode} is a symbol | |
| 80 | Most programming-language major modes specify that only blank lines | 73 | with the same name as the major mode command (e.g. @code{lisp-mode}). |
| 81 | separate paragraphs. This is to make the paragraph commands useful. | 74 | This variable is set automatically; you should not change it yourself. |
| 82 | (@xref{Paragraphs}.) They also cause Auto Fill mode to use the | 75 | |
| 83 | definition of @key{TAB} to indent the new lines it creates. This is | 76 | The default value of @code{major-mode} determines the major mode to |
| 84 | because most lines in a program are usually indented | 77 | use for files that do not specify a major mode, and for new buffers |
| 85 | (@pxref{Indentation}). | 78 | created with @kbd{C-x b}. Normally, this default value is the symbol |
| 79 | @code{fundamental-mode}, which specifies Fundamental mode. You can | ||
| 80 | change this default value via the Customization interface (@pxref{Easy | ||
| 81 | Customization}), or by adding a line like this to your init file | ||
| 82 | (@pxref{Init File}): | ||
| 83 | |||
| 84 | @smallexample | ||
| 85 | (setq-default major-mode 'text-mode) | ||
| 86 | @end smallexample | ||
| 87 | |||
| 88 | @noindent | ||
| 89 | If the default value of @code{major-mode} is @code{nil}, the major | ||
| 90 | mode is taken from the previously current buffer. | ||
| 91 | |||
| 92 | Specialized major modes often change the meanings of certain keys to | ||
| 93 | do something more suitable for the mode. For instance, programming | ||
| 94 | language modes bind @key{TAB} to indent the current line according to | ||
| 95 | the rules of the language (@pxref{Indentation}). The keys that are | ||
| 96 | commonly changed are @key{TAB}, @key{DEL}, and @kbd{C-j}. Many modes | ||
| 97 | also define special commands of their own, usually bound in the prefix | ||
| 98 | key @kbd{C-c}. Major modes can also alter user options and variables; | ||
| 99 | for instance, programming language modes typicaly set a buffer-local | ||
| 100 | value for the variable @code{comment-start}, which determines how | ||
| 101 | source code comments are delimited (@pxref{Comments}). | ||
| 102 | |||
| 103 | @findex describe-mode | ||
| 104 | @kindex C-h m | ||
| 105 | To view the documentation for the current major mode, including a | ||
| 106 | list of its key bindings, type @code{C-h m} (@code{describe-mode}). | ||
| 107 | |||
| 108 | @cindex mode hook | ||
| 109 | @vindex text-mode-hook | ||
| 110 | @vindex prog-mode-hook | ||
| 111 | Every major mode, apart from Fundamental mode, defines a @dfn{mode | ||
| 112 | hook}, a customizable list of Lisp functions to run each time the mode | ||
| 113 | is enabled in a buffer. @xref{Hooks}, for more information about | ||
| 114 | hooks. Each mode hook is named after its major mode, e.g. Fortran | ||
| 115 | mode has @code{fortran-mode-hook}. Furthermore, all text-based major | ||
| 116 | modes run @code{text-mode-hook}, and all programming language modes | ||
| 117 | run @code{prog-mode-hook}, prior to running their own mode hooks. | ||
| 118 | |||
| 119 | Mode hooks are commonly used to enable minor modes (@pxref{Minor | ||
| 120 | Modes}). For example, you can put the following lines in your init | ||
| 121 | file to enable Flyspell minor mode in all text-based major modes | ||
| 122 | (@pxref{Spelling}), and Eldoc minor mode in Emacs Lisp mode | ||
| 123 | (@pxref{Lisp Doc}): | ||
| 124 | |||
| 125 | @example | ||
| 126 | (add-hook 'text-mode-hook 'flyspell-mode) | ||
| 127 | (add-hook 'emacs-lisp-mode-hook 'eldoc-mode) | ||
| 128 | @end example | ||
| 86 | 129 | ||
| 87 | @node Minor Modes | 130 | @node Minor Modes |
| 88 | @section Minor Modes | 131 | @section Minor Modes |
| 89 | @cindex minor modes | 132 | @cindex minor modes |
| 90 | @cindex mode, minor | 133 | @cindex mode, minor |
| 91 | 134 | ||
| 92 | A minor mode is an optional editing modes that alters the behavior | 135 | A minor mode is an optional editing mode that alters the behavior of |
| 93 | of Emacs in some well-defined way. Unlike major modes, any number of | 136 | Emacs in some well-defined way. Unlike major modes, any number of |
| 94 | minor modes can be in effect at any time. Some minor modes are | 137 | minor modes can be in effect at any time. Some minor modes are |
| 95 | @dfn{buffer-local}: they apply only to the current buffer, so you can | 138 | @dfn{buffer-local}, and can be turned on (enabled) in certain buffers |
| 96 | enable the mode in certain buffers and not others. Other minor modes | 139 | and off (disabled) in others. Other minor modes are @dfn{global}: |
| 97 | are @dfn{global}: while enabled, they affect everything you do in the | 140 | while enabled, they affect everything you do in the Emacs session, in |
| 98 | Emacs session, in all buffers. Some global minor modes are enabled by | 141 | all buffers. Most minor modes are disabled by default, but a few are |
| 99 | default. | 142 | enabled by default. |
| 100 | 143 | ||
| 101 | Most minor modes say in the mode line when they are enabled, just | 144 | Most buffer-local minor modes say in the mode line when they are |
| 102 | after the major mode indicator. For example, @samp{Fill} in the mode | 145 | enabled, just after the major mode indicator. For example, |
| 103 | line means that Auto Fill mode is enabled. @xref{Mode Line}. | 146 | @samp{Fill} in the mode line means that Auto Fill mode is enabled. |
| 104 | 147 | @xref{Mode Line}. | |
| 105 | Each minor mode is associated with a command, called the @dfn{mode | 148 | |
| 106 | command}, which turns it on or off. The name of this command consists | 149 | @cindex mode commands for minor modes |
| 107 | of the name of the minor mode, followed by @samp{-mode}; for instance, | 150 | Like major modes, each minor mode is associated with a @dfn{mode |
| 108 | the mode command for Auto Fill mode is @code{auto-fill-mode}. Calling | 151 | command}, whose name consists of the mode name followed by |
| 109 | the minor mode command with no prefix argument @dfn{toggles} the mode, | 152 | @samp{-mode}. For instance, the mode command for Auto Fill mode is |
| 110 | turning it on if it was off, and off if it was on. A positive | 153 | @code{auto-fill-mode}. But unlike a major mode command, which simply |
| 111 | argument always turns the mode on, and a zero or negative argument | 154 | enables the mode, the mode command for a minor mode can either enable |
| 112 | always turns it off. Mode commands are usually invoked with | 155 | or disable it: |
| 113 | @kbd{M-x}, but you can bind keys to them if you wish (@pxref{Key | 156 | |
| 114 | Bindings}). | 157 | @itemize |
| 158 | @item | ||
| 159 | If you invoke the mode command directly with no prefix argument | ||
| 160 | (either via @kbd{M-x}, or by binding it to a key and typing that key; | ||
| 161 | @pxref{Key Bindings}), that @dfn{toggles} the minor mode. The minor | ||
| 162 | mode is turned on if it was off, and turned off if it was on. | ||
| 163 | |||
| 164 | @item | ||
| 165 | If you invoke the mode command with a prefix argument, the minor mode | ||
| 166 | is unconditionally turned off if that argument is zero or negative; | ||
| 167 | otherwise, it is unconditionally turned on. | ||
| 168 | |||
| 169 | @item | ||
| 170 | If the mode command is called via Lisp, the minor mode is | ||
| 171 | unconditionally turned on if the argument is omitted or @code{nil}. | ||
| 172 | This makes it easy to turn on a minor mode from a major mode's mode | ||
| 173 | hook (@pxref{Major Modes}). A non-@code{nil} argument is handled like | ||
| 174 | an interactive prefix argument, as described above. | ||
| 175 | @end itemize | ||
| 115 | 176 | ||
| 116 | Most minor modes also have a @dfn{mode variable}, with the same name | 177 | Most minor modes also have a @dfn{mode variable}, with the same name |
| 117 | as the mode command. Its value is non-@code{nil} if the mode is | 178 | as the mode command. Its value is non-@code{nil} if the mode is |
| 118 | enabled, and @code{nil} if it is disabled. In some minor modes---but | 179 | enabled, and @code{nil} if it is disabled. In general, you should not |
| 119 | not all---the value of the variable alone determines whether the mode | 180 | try to enable or disable the mode by changing the value of the mode |
| 120 | is active: the mode command works simply by setting the variable, and | 181 | variable directly in Lisp; you should run the mode command instead. |
| 121 | changing the value of the variable has the same effect as calling the | 182 | However, setting the mode variable through the Customize interface |
| 122 | mode command. Because not all minor modes work this way, we recommend | 183 | (@pxref{Easy Customization}) will always properly enable or disable |
| 123 | that you avoid changing the mode variables directly; use the mode | 184 | the mode, since Customize automatically runs the mode command for you. |
| 124 | commands instead. | ||
| 125 | 185 | ||
| 126 | The following is a list of some buffer-local minor modes: | 186 | The following is a list of some buffer-local minor modes: |
| 127 | 187 | ||
| @@ -189,11 +249,8 @@ Visual Line mode performs ``word wrapping'', causing long lines to be | |||
| 189 | wrapped at word boundaries. @xref{Visual Line Mode}. | 249 | wrapped at word boundaries. @xref{Visual Line Mode}. |
| 190 | @end itemize | 250 | @end itemize |
| 191 | 251 | ||
| 192 | Here are some useful global minor modes. Since Line Number mode and | 252 | @noindent |
| 193 | Transient Mark mode can be enabled or disabled just by setting the | 253 | And here are some useful global minor modes: |
| 194 | value of the minor mode variable, you @emph{can} set them differently | ||
| 195 | for particular buffers, by explicitly making the corresponding | ||
| 196 | variable local in those buffers. @xref{Locals}. | ||
| 197 | 254 | ||
| 198 | @itemize @bullet | 255 | @itemize @bullet |
| 199 | @item | 256 | @item |
| @@ -261,22 +318,27 @@ text may appear on the line as well. For example, | |||
| 261 | 318 | ||
| 262 | @noindent | 319 | @noindent |
| 263 | tells Emacs to use Lisp mode. Note how the semicolon is used to make | 320 | tells Emacs to use Lisp mode. Note how the semicolon is used to make |
| 264 | Lisp treat this line as a comment. Alternatively, you could write | 321 | Lisp treat this line as a comment. You could equivalently write |
| 265 | 322 | ||
| 266 | @example | 323 | @example |
| 267 | ; -*- mode: Lisp;-*- | 324 | ; -*- mode: Lisp;-*- |
| 268 | @end example | 325 | @end example |
| 269 | 326 | ||
| 270 | @noindent | 327 | @noindent |
| 271 | The latter format allows you to specify local variables as well, like | 328 | You can also use file-local variables to specify buffer-local minor |
| 272 | this: | 329 | modes, by using @code{eval} specifications. For example, this first |
| 330 | nonblank line puts the buffer in Lisp mode and enables Auto-Fill mode: | ||
| 273 | 331 | ||
| 274 | @example | 332 | @example |
| 275 | ; -*- mode: Lisp; tab-width: 4; -*- | 333 | ; -*- mode: Lisp; eval: (auto-fill-mode 1); -*- |
| 276 | @end example | 334 | @end example |
| 277 | 335 | ||
| 278 | If a file variable specifies a buffer-local minor mode, Emacs | 336 | @noindent |
| 279 | enables that minor mode in the buffer. | 337 | Note, however, that it is usually inappropriate to enable minor modes |
| 338 | this way, since most minor modes represent individual user | ||
| 339 | preferences. If you personally want to use a minor mode for a | ||
| 340 | particular file type, it is better to enable the minor mode via a | ||
| 341 | major mode hook (@pxref{Major Modes}). | ||
| 280 | 342 | ||
| 281 | @vindex interpreter-mode-alist | 343 | @vindex interpreter-mode-alist |
| 282 | Second, if there is no file variable specifying a major mode, Emacs | 344 | Second, if there is no file variable specifying a major mode, Emacs |
| @@ -310,9 +372,9 @@ elements of the form | |||
| 310 | 372 | ||
| 311 | @noindent | 373 | @noindent |
| 312 | where @var{regexp} is a regular expression (@pxref{Regexps}), and | 374 | where @var{regexp} is a regular expression (@pxref{Regexps}), and |
| 313 | @var{mode-function} is a Lisp function that toggles a major mode. If | 375 | @var{mode-function} is a major mode command. If the text at the |
| 314 | the text at the beginning of the file matches @var{regexp}, Emacs | 376 | beginning of the file matches @var{regexp}, Emacs chooses the major |
| 315 | chooses the major mode specified by @var{mode-function}. | 377 | mode specified by @var{mode-function}. |
| 316 | 378 | ||
| 317 | Alternatively, an element of @code{magic-mode-alist} may have the form | 379 | Alternatively, an element of @code{magic-mode-alist} may have the form |
| 318 | 380 | ||
| @@ -323,7 +385,7 @@ Alternatively, an element of @code{magic-mode-alist} may have the form | |||
| 323 | @noindent | 385 | @noindent |
| 324 | where @var{match-function} is a Lisp function that is called at the | 386 | where @var{match-function} is a Lisp function that is called at the |
| 325 | beginning of the buffer; if the function returns non-@code{nil}, Emacs | 387 | beginning of the buffer; if the function returns non-@code{nil}, Emacs |
| 326 | set the major mode wit @var{mode-function}. | 388 | set the major mode with @var{mode-function}. |
| 327 | 389 | ||
| 328 | Fourth---if Emacs still hasn't found a suitable major mode---it | 390 | Fourth---if Emacs still hasn't found a suitable major mode---it |
| 329 | looks at the file's name. The correspondence between file names and | 391 | looks at the file's name. The correspondence between file names and |
| @@ -370,29 +432,6 @@ only after @code{auto-mode-alist}. By default, | |||
| 370 | @code{magic-fallback-mode-alist} contains forms that check for image | 432 | @code{magic-fallback-mode-alist} contains forms that check for image |
| 371 | files, HTML/XML/SGML files, and PostScript files. | 433 | files, HTML/XML/SGML files, and PostScript files. |
| 372 | 434 | ||
| 373 | @vindex major-mode | ||
| 374 | Once a major mode is chosen, Emacs sets the value of the variable | ||
| 375 | @code{major-mode} to the symbol for that major mode (e.g., | ||
| 376 | @code{text-mode} for Text mode). This is a per-buffer variable | ||
| 377 | (@pxref{Locals}); its buffer-local value is set automatically, and you | ||
| 378 | should not change it yourself. | ||
| 379 | |||
| 380 | The default value of @code{major-mode} determines the major mode to | ||
| 381 | use for files that do not specify a major mode, and for new buffers | ||
| 382 | created with @kbd{C-x b}. Normally, this default value is the symbol | ||
| 383 | @code{fundamental-mode}, which specifies Fundamental mode. You can | ||
| 384 | change it via the Customization interface (@pxref{Easy | ||
| 385 | Customization}), or by adding a line like this to your init file | ||
| 386 | (@pxref{Init File}): | ||
| 387 | |||
| 388 | @smallexample | ||
| 389 | (setq-default major-mode 'text-mode) | ||
| 390 | @end smallexample | ||
| 391 | |||
| 392 | @noindent | ||
| 393 | If the default value of @code{major-mode} is @code{nil}, the major | ||
| 394 | mode is taken from the previously current buffer. | ||
| 395 | |||
| 396 | @findex normal-mode | 435 | @findex normal-mode |
| 397 | If you have changed the major mode of a buffer, you can return to | 436 | If you have changed the major mode of a buffer, you can return to |
| 398 | the major mode Emacs would have chosen automatically, by typing | 437 | the major mode Emacs would have chosen automatically, by typing |