diff options
| author | Chong Yidong | 2010-03-06 14:02:49 -0500 |
|---|---|---|
| committer | Chong Yidong | 2010-03-06 14:02:49 -0500 |
| commit | 17782becc562c0cc03df654e33f60acc183cc3a7 (patch) | |
| tree | d78547a74eb6ecbe63b908f99ede897d55a70c05 | |
| parent | a4e32226ebee93d94744cd9149a73e6b59785cd9 (diff) | |
| download | emacs-17782becc562c0cc03df654e33f60acc183cc3a7.tar.gz emacs-17782becc562c0cc03df654e33f60acc183cc3a7.zip | |
Improve documentation for setting buffer-local vars (Bug#5688).
* custom.texi (Init Examples): Add xref to Locals.
* major.texi (Choosing Modes): Mention usage of setq-default for
setting the default value of major-mode (Bug#5688).
| -rw-r--r-- | doc/emacs/ChangeLog | 7 | ||||
| -rw-r--r-- | doc/emacs/custom.texi | 7 | ||||
| -rw-r--r-- | doc/emacs/major.texi | 34 |
3 files changed, 36 insertions, 12 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index a9d7e1bcf69..55ae0882882 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-03-06 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * custom.texi (Init Examples): Add xref to Locals. | ||
| 4 | |||
| 5 | * major.texi (Choosing Modes): Mention usage of setq-default for | ||
| 6 | setting the default value of major-mode (Bug#5688). | ||
| 7 | |||
| 1 | 2010-03-02 Chong Yidong <cyd@stupidchicken.com> | 8 | 2010-03-02 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 9 | ||
| 3 | * frames.texi (Mouse Avoidance): Mention make-pointer-invisible. | 10 | * frames.texi (Mouse Avoidance): Mention make-pointer-invisible. |
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index a4914531192..408de24ed6e 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -2256,9 +2256,10 @@ override this). | |||
| 2256 | @end example | 2256 | @end example |
| 2257 | 2257 | ||
| 2258 | This sets the default value, which is effective in all buffers that do | 2258 | This sets the default value, which is effective in all buffers that do |
| 2259 | not have local values for the variable. Setting @code{case-fold-search} | 2259 | not have local values for the variable (@pxref{Locals}). Setting |
| 2260 | with @code{setq} affects only the current buffer's local value, which | 2260 | @code{case-fold-search} with @code{setq} affects only the current |
| 2261 | is not what you probably want to do in an init file. | 2261 | buffer's local value, which is probably not what you want to do in an |
| 2262 | init file. | ||
| 2262 | 2263 | ||
| 2263 | @item | 2264 | @item |
| 2264 | @vindex user-mail-address | 2265 | @vindex user-mail-address |
diff --git a/doc/emacs/major.texi b/doc/emacs/major.texi index e2e7c3d2a4c..19ab86f91dd 100644 --- a/doc/emacs/major.texi +++ b/doc/emacs/major.texi | |||
| @@ -196,17 +196,33 @@ only after @code{auto-mode-alist}. By default, | |||
| 196 | @code{magic-fallback-mode-alist} contains forms that check for image | 196 | @code{magic-fallback-mode-alist} contains forms that check for image |
| 197 | files, HTML/XML/SGML files, and Postscript files. | 197 | files, HTML/XML/SGML files, and Postscript files. |
| 198 | 198 | ||
| 199 | When you visit a file that does not specify a major mode to use, or | 199 | @vindex major-mode |
| 200 | when you create a new buffer with @kbd{C-x b}, the default value of | 200 | Once a major mode is chosen, Emacs sets the value of the variable |
| 201 | the variable @code{major-mode} specifies which major mode to use. Normally | 201 | @code{major-mode} to the symbol for that major mode (e.g., |
| 202 | its value is the symbol @code{fundamental-mode}, which specifies | 202 | @code{text-mode} for Text mode). This is a per-buffer variable |
| 203 | Fundamental mode. If the default value of @code{major-mode} is @code{nil}, | 203 | (@pxref{Locals}); its buffer-local value is set automatically, and you |
| 204 | the major mode is taken from the previously current buffer. | 204 | should not change it yourself. |
| 205 | |||
| 206 | The default value of @code{major-mode} determines the major mode to | ||
| 207 | use for files that do not specify a major mode, and for new buffers | ||
| 208 | created with @kbd{C-x b}. Normally, this default value is the symbol | ||
| 209 | @code{fundamental-mode}, which specifies Fundamental mode. You can | ||
| 210 | change it via the Customization interface (@pxref{Easy | ||
| 211 | Customization}), or by adding a line like this to your init file | ||
| 212 | (@pxref{Init File}): | ||
| 213 | |||
| 214 | @smallexample | ||
| 215 | (setq-default major-mode 'text-mode) | ||
| 216 | @end smallexample | ||
| 217 | |||
| 218 | @noindent | ||
| 219 | If the default value of @code{major-mode} is @code{nil}, the major | ||
| 220 | mode is taken from the previously current buffer. | ||
| 205 | 221 | ||
| 206 | @findex normal-mode | 222 | @findex normal-mode |
| 207 | If you change the major mode of a buffer, you can go back to the major | 223 | If you have changed the major mode of a buffer, you can return to |
| 208 | mode Emacs would choose automatically: use the command @kbd{M-x | 224 | the major mode Emacs would have chosen automatically, by typing |
| 209 | normal-mode} to do this. This is the same function that | 225 | @kbd{M-x normal-mode}. This is the same function that |
| 210 | @code{find-file} calls to choose the major mode. It also processes | 226 | @code{find-file} calls to choose the major mode. It also processes |
| 211 | the file's @samp{-*-} line or local variables list (if any). | 227 | the file's @samp{-*-} line or local variables list (if any). |
| 212 | @xref{File Variables}. | 228 | @xref{File Variables}. |