Commit 6e317956 authored by Chong Yidong's avatar Chong Yidong
Browse files

Adapt to new minor mode function behavior in manual examples.

* doc/emacs/custom.texi (Hooks, Init Examples):
* doc/emacs/display.texi (Font Lock):
* doc/emacs/fixit.texi (Spelling):
* doc/emacs/rmail.texi (Rmail Display): Minor mode function with no arg now
enables it.

* doc/emacs/fixit.texi (Spelling): Fix description of inline completion.
parent ac6c8639
2011-10-20 Chong Yidong <cyd@gnu.org>
* custom.texi (Hooks, Init Examples):
* display.texi (Font Lock):
* fixit.texi (Spelling):
* rmail.texi (Rmail Display): Minor mode function with no arg now
enables it.
* fixit.texi (Spelling): Fix description of inline completion.
2011-10-19 Chong Yidong <cyd@gnu.org> 2011-10-19 Chong Yidong <cyd@gnu.org>
* search.texi (Repeat Isearch, Error in Isearch): Add kindex * search.texi (Repeat Isearch, Error in Isearch): Add kindex
......
...@@ -770,7 +770,7 @@ here's how to set up a hook to turn on Auto Fill mode when entering ...@@ -770,7 +770,7 @@ here's how to set up a hook to turn on Auto Fill mode when entering
Text mode and other modes based on Text mode: Text mode and other modes based on Text mode:
@example @example
(add-hook 'text-mode-hook 'turn-on-auto-fill) (add-hook 'text-mode-hook 'auto-fill-mode)
@end example @end example
Here is another example, showing how to use a hook to customize the Here is another example, showing how to use a hook to customize the
...@@ -2174,8 +2174,7 @@ Turn off Line Number mode, a global minor mode. ...@@ -2174,8 +2174,7 @@ Turn off Line Number mode, a global minor mode.
Turn on Auto Fill mode automatically in Text mode and related modes. Turn on Auto Fill mode automatically in Text mode and related modes.
@example @example
(add-hook 'text-mode-hook (add-hook 'text-mode-hook 'auto-fill-mode)
'(lambda () (auto-fill-mode 1)))
@end example @end example
This shows how to add a hook function to a normal hook variable This shows how to add a hook function to a normal hook variable
...@@ -2183,19 +2182,9 @@ This shows how to add a hook function to a normal hook variable ...@@ -2183,19 +2182,9 @@ This shows how to add a hook function to a normal hook variable
@code{lambda}, with a single-quote in front of it to make it a list @code{lambda}, with a single-quote in front of it to make it a list
constant rather than an expression. constant rather than an expression.
It's beyond the scope of this manual to explain Lisp functions, but for It's beyond the scope of this manual to explain Lisp functions, but
this example it is enough to know that the effect is to execute for this example it is enough to know that the effect is to execute
@code{(auto-fill-mode 1)} when Text mode is entered. You can replace the @code{auto-fill-mode} function when Text mode is entered.
that with any other expression that you like, or with several
expressions in a row.
Emacs comes with a function named @code{turn-on-auto-fill} whose
definition is @code{(lambda () (auto-fill-mode 1))}. Thus, a simpler
way to write the above example is as follows:
@example
(add-hook 'text-mode-hook 'turn-on-auto-fill)
@end example
@item @item
Load the installed Lisp library named @file{foo} (actually a file Load the installed Lisp library named @file{foo} (actually a file
......
...@@ -703,16 +703,14 @@ file: ...@@ -703,16 +703,14 @@ file:
(global-font-lock-mode 0) (global-font-lock-mode 0)
@end example @end example
@findex turn-on-font-lock
@noindent @noindent
If you have disabled Global Font Lock mode, you can still enable Font If you have disabled Global Font Lock mode, you can still enable Font
Lock for specific major modes by adding the function Lock for specific major modes by adding the function
@code{turn-on-font-lock} to the mode hooks (@pxref{Hooks}). For @code{font-lock-mode} to the mode hooks (@pxref{Hooks}). For example,
example, to enable Font Lock mode for editing C files, you can do to enable Font Lock mode for editing C files, you can do this:
this:
@example @example
(add-hook 'c-mode-hook 'turn-on-font-lock) (add-hook 'c-mode-hook 'font-lock-mode)
@end example @end example
Font Lock mode uses several specifically named faces to do its job, Font Lock mode uses several specifically named faces to do its job,
......
...@@ -7,17 +7,14 @@ ...@@ -7,17 +7,14 @@
@cindex typos, fixing @cindex typos, fixing
@cindex mistakes, correcting @cindex mistakes, correcting
In this chapter we describe the commands that are especially useful In this chapter we describe commands that are useful when you catch
when you catch a mistake in your text after you have made it, or a mistake while editing. The most fundamental command for correcting
change your mind while composing text on the fly. erroneous editing is the undo command @kbd{C-/} (which is also bound
to @kbd{C-x u} and @kbd{C-_}). This undoes a single command, or a
The most fundamental command for correcting erroneous editing is the part of a command (as in the case of @code{query-replace}), or several
undo command @kbd{C-/} (which is also bound to @kbd{C-x u} and consecutive character insertions. Consecutive repetitions of
@kbd{C-_}). This undoes a single command, or a part of a command (as @kbd{C-/} undo earlier and earlier changes, back to the limit of the
in the case of @code{query-replace}), or several consecutive undo information available.
self-inserting characters. Consecutive repetitions of @kbd{C-/} undo
earlier and earlier changes, back to the limit of the undo information
available.
Aside from the commands described here, you can erase text using Aside from the commands described here, you can erase text using
deletion commands such as @key{DEL} (@code{delete-backward-char}). deletion commands such as @key{DEL} (@code{delete-backward-char}).
...@@ -231,18 +228,19 @@ case-convert it and go on typing. @xref{Case}.@refill ...@@ -231,18 +228,19 @@ case-convert it and go on typing. @xref{Case}.@refill
This section describes the commands to check the spelling of a This section describes the commands to check the spelling of a
single word or of a portion of a buffer. These commands only work if single word or of a portion of a buffer. These commands only work if
the spelling checker program Aspell, Ispell or Hunspell is installed. the spelling checker program Aspell, Ispell or Hunspell is installed.
Aspell, Ispell or Hunspell are not part of Emacs, but one or the other These programs are not part of Emacs, but one of them is usually
is usually installed in GNU/Linux and other free operating systems. installed in GNU/Linux and other free operating systems.
@ifnottex @ifnottex
@xref{Top, Aspell,, aspell, The Aspell Manual}. @xref{Top, Aspell,, aspell, The Aspell Manual}.
@end ifnottex @end ifnottex
@table @kbd @table @kbd
@item M-$ @item M-$
Check and correct spelling of the active region or the word at point Check and correct spelling of the word at point (@code{ispell-word}).
(@code{ispell-word}). If the region is active, do it for all words in the region instead.
@item M-x ispell @item M-x ispell
Check and correct spelling in the active region or the entire buffer. Check and correct spelling of all words in the buffer. If the region
is active, do it for all words in the region instead.
@item M-x ispell-buffer @item M-x ispell-buffer
Check and correct spelling in the buffer. Check and correct spelling in the buffer.
@item M-x ispell-region @item M-x ispell-region
...@@ -355,14 +353,13 @@ Show the list of options. ...@@ -355,14 +353,13 @@ Show the list of options.
@end table @end table
@findex ispell-complete-word @findex ispell-complete-word
In Text mode and related modes, the command @kbd{M-@key{TAB}} In Text mode and related modes, @kbd{M-@key{TAB}}
(@code{ispell-complete-word}) shows a list of completions based on (@code{ispell-complete-word}) performs in-buffer completion based on
spelling correction. Insert the beginning of a word, and then type spelling correction. Insert the beginning of a word, and then type
@kbd{M-@key{TAB}}; the command displays a completion list window. (If @kbd{M-@key{TAB}}; this shows shows a list of completions. (If your
your window manager intercepts @kbd{M-@key{TAB}}, type @kbd{@key{ESC} window manager intercepts @kbd{M-@key{TAB}}, type @kbd{@key{ESC}
@key{TAB}} or @kbd{C-M-i}.) To choose one of the completions listed, @key{TAB}} or @kbd{C-M-i}.) Each completion is listed with a digit or
click @kbd{Mouse-2} or @kbd{Mouse-1} fast on it, or move the cursor character; type that digit or character to choose it.
there in the completions window and type @key{RET}. @xref{Text Mode}.
@cindex @code{ispell} program @cindex @code{ispell} program
@findex ispell-kill-ispell @findex ispell-kill-ispell
...@@ -370,29 +367,27 @@ there in the completions window and type @key{RET}. @xref{Text Mode}. ...@@ -370,29 +367,27 @@ there in the completions window and type @key{RET}. @xref{Text Mode}.
to run, waiting for something to do, so that subsequent spell checking to run, waiting for something to do, so that subsequent spell checking
commands complete more quickly. If you want to get rid of the commands complete more quickly. If you want to get rid of the
process, use @kbd{M-x ispell-kill-ispell}. This is not usually process, use @kbd{M-x ispell-kill-ispell}. This is not usually
necessary, since the process uses no time except when you do spelling necessary, since the process uses no processor time except when you do
correction. spelling correction.
@vindex ispell-dictionary @vindex ispell-dictionary
@vindex ispell-local-dictionary @vindex ispell-local-dictionary
@vindex ispell-personal-dictionary @vindex ispell-personal-dictionary
@vindex ispell-complete-word-dict @findex ispell-change-dictionary
Ispell, Aspell and Hunspell use two dictionaries together for spell checking: Ispell, Aspell and Hunspell look up spelling in two dictionaries:
the standard dictionary and your private dictionary. The standard the standard dictionary and your personal dictionary. The standard
dictionary is specified by @code{ispell-local-dictionary} or, dictionary is specified by the variable @code{ispell-local-dictionary}
if @code{nil}, by @code{ispell-dictionary}. If both are @code{nil} or, if that is @code{nil}, by the variable @code{ispell-dictionary}.
the default dictionary is selected. The command If both are @code{nil}, the spelling program's default dictionary is
@kbd{M-x ispell-change-dictionary} sets the standard dictionary for used. The command @kbd{M-x ispell-change-dictionary} sets the
the buffer and then restarts the subprocess, so that it will use a standard dictionary for the buffer and then restarts the subprocess,
different standard dictionary. Personal dictionary is specified by so that it will use a different standard dictionary. Your personal
@code{ispell-personal-dictionary}. If @code{nil}, default value is dictionary is specified by the variable
used. @code{ispell-personal-dictionary}. If that is @code{nil}, the
spelling program looks for a personal dictionary in a default
Set variable @code{ispell-dictionary} to select a specific default location.
dictionary for all your documents. Set variable
@code{ispell-local-dictionary} in the local variables section to
select a specific dictionary for a given document.
@vindex ispell-complete-word-dict
A separate dictionary is used for word completion. The variable A separate dictionary is used for word completion. The variable
@code{ispell-complete-word-dict} specifies the file name of this @code{ispell-complete-word-dict} specifies the file name of this
dictionary. The completion dictionary must be different because it dictionary. The completion dictionary must be different because it
...@@ -400,16 +395,14 @@ cannot use root and affix information. For some languages, there ...@@ -400,16 +395,14 @@ cannot use root and affix information. For some languages, there
is a spell checking dictionary but no word completion dictionary. is a spell checking dictionary but no word completion dictionary.
@cindex Flyspell mode @cindex Flyspell mode
@cindex mode, Flyspell
@findex flyspell-mode @findex flyspell-mode
@findex turn-on-flyspell Flyspell mode is a minor mode that performs automatic spell checking
Flyspell mode is a fully-automatic way to check spelling as you edit as you type. When it finds a word that it does not recognize, it
in Emacs. It operates by checking words as you change or insert them. highlights that word. Type @kbd{M-x flyspell-mode} to toggle Flyspell
When it finds a word that it does not recognize, it highlights that mode in the current buffer. To enable Flyspell mode in all text mode
word. This does not interfere with your editing, but when you see the buffers, add @code{flyspell-mode} to @code{text-mode-hook}.
highlighted word, you can move to it and fix it. Type @kbd{M-x @xref{Hooks}.
flyspell-mode} to enable or disable this mode in the current buffer.
To enable Flyspell mode in all text mode buffers, add
@code{turn-on-flyspell} to @code{text-mode-hook}.
When Flyspell mode highlights a word as misspelled, you can click on When Flyspell mode highlights a word as misspelled, you can click on
it with @kbd{Mouse-2} to display a menu of possible corrections and it with @kbd{Mouse-2} to display a menu of possible corrections and
......
...@@ -479,7 +479,7 @@ variable @code{fortran-break-before-delimiters} is @code{nil}. ...@@ -479,7 +479,7 @@ variable @code{fortran-break-before-delimiters} is @code{nil}.
Otherwise (and by default), the break comes before the delimiter. Otherwise (and by default), the break comes before the delimiter.
To enable Auto Fill in all Fortran buffers, add To enable Auto Fill in all Fortran buffers, add
@code{turn-on-auto-fill} to @code{fortran-mode-hook}. @code{auto-fill-mode} to @code{fortran-mode-hook}.
@iftex @iftex
@xref{Hooks,,, emacs, the Emacs Manual}. @xref{Hooks,,, emacs, the Emacs Manual}.
@end iftex @end iftex
......
...@@ -1198,7 +1198,7 @@ Address mode: ...@@ -1198,7 +1198,7 @@ Address mode:
@c FIXME goto-addr.el commentary says to use goto-address instead. @c FIXME goto-addr.el commentary says to use goto-address instead.
@smallexample @smallexample
(add-hook 'rmail-show-message-hook (lambda () (goto-address-mode 1))) (add-hook 'rmail-show-message-hook 'goto-address-mode)
@end smallexample @end smallexample
@noindent @noindent
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment