X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b6bd159922608fa474026837771d63bf7eadcf97..9418ab39bf970dd82b5d6f2e7b40a5d8cd134a43:/doc/emacs/fixit.texi?ds=inline diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi index c14041f227..584efc6811 100644 --- a/doc/emacs/fixit.texi +++ b/doc/emacs/fixit.texi @@ -1,23 +1,20 @@ @c This is part of the Emacs manual. -@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2011 -@c Free Software Foundation, Inc. +@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2016 Free Software +@c Foundation, Inc. @c See file emacs.texi for copying conditions. -@node Fixit, Keyboard Macros, Search, Top +@node Fixit @chapter Commands for Fixing Typos @cindex typos, fixing @cindex mistakes, correcting - In this chapter we describe the commands that are especially useful -when you catch a mistake in your text after you have made it, or -change your mind while composing text on the fly. - - The most fundamental command for correcting 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 part of a command (as -in the case of @code{query-replace}), or several consecutive -self-inserting characters. Consecutive repetitions of @kbd{C-/} undo -earlier and earlier changes, back to the limit of the undo information -available. + In this chapter we describe commands that are useful when you catch +a mistake while editing. The most fundamental of these commands is +the undo command @kbd{C-/} (also bound to @kbd{C-x u} and @kbd{C-_}). +This undoes a single command, or a +part of a command (as in the case of @code{query-replace}), or several +consecutive character insertions. 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 deletion commands such as @key{DEL} (@code{delete-backward-char}). @@ -38,7 +35,7 @@ These were described earlier in this manual. @xref{Erasing}. The @dfn{undo} command reverses recent changes in the buffer's text. Each buffer records changes individually, and the undo command always applies to the current buffer. You can undo all the changes in a -buffer for as far as back its records go. Usually, each editing +buffer for as far back as the buffer's records go. Usually, each editing command makes a separate entry in the undo records, but some commands such as @code{query-replace} divide their changes into multiple entries for flexibility in undoing. Consecutive character insertion @@ -60,10 +57,9 @@ Undo one entry in the current buffer's undo records (@code{undo}). @kbd{C-x u})@footnote{Aside from @kbd{C-/}, the @code{undo} command is also bound to @kbd{C-x u} because that is more straightforward for beginners to remember: @samp{u} stands for ``undo''. It is also bound -to @kbd{C-_} because typing @kbd{C-/} on some text-only terminals -actually enters @kbd{C-_}.}. This undoes the most recent change in -the buffer, and moves point back to where it was before that change. - +to @kbd{C-_} because typing @kbd{C-/} on some text terminals actually +enters @kbd{C-_}.}. This undoes the most recent change in the buffer, +and moves point back to where it was before that change. Consecutive repetitions of @kbd{C-/} (or its aliases) undo earlier and earlier changes in the current buffer. If all the recorded changes have already been undone, the undo command signals an error. @@ -78,10 +74,11 @@ changes you have undone, type @kbd{C-f} or any other command that harmlessly breaks the sequence of undoing; then type @kbd{C-/} to undo the undo command. - On the other hand, if you want to resume undoing, without redoing + Alternatively, if you want to resume undoing, without redoing previous undo commands, use @kbd{M-x undo-only}. This is like @code{undo}, but will not redo changes you have just undone. +@c What about @kbd{M-x revert-buffer}? --xfq If you notice that a buffer has been modified accidentally, the easiest way to recover is to type @kbd{C-/} repeatedly until the stars disappear from the front of the mode line (@pxref{Mode Line}). @@ -98,11 +95,12 @@ was deliberate, redo the change as described above. When there is an active region, any use of @code{undo} performs @dfn{selective undo}: it undoes the most recent change within the region, instead of the entire buffer. However, when Transient Mark -mode is off (@pxref{Persistent Mark}), @kbd{C-/} always operates on -the entire buffer, ignoring the region. In this case, you can perform -selective undo by supplying a prefix argument to the @code{undo} -command: @kbd{C-u C-/}. To undo further changes in the same region, -repeat the @code{undo} command (no prefix argument is needed). +mode is off (@pxref{Disabled Transient Mark}), @kbd{C-/} always +operates on the entire buffer, ignoring the region. In this case, you +can perform selective undo by supplying a prefix argument to the +@code{undo} command: @kbd{C-u C-/}. To undo further changes in the +same region, repeat the @code{undo} command (no prefix argument is +needed). Some specialized buffers do not make undo records. Buffers whose names start with spaces never do; these buffers are used internally by @@ -112,9 +110,9 @@ Emacs to hold text that users don't normally look at or edit. @vindex undo-strong-limit @vindex undo-outer-limit @cindex undo limit - When the undo records for a buffer becomes too large, Emacs discards -the oldest undo records from time to time (during @dfn{garbage -collection}). You can specify how much undo records to keep by + When the undo information for a buffer becomes too large, Emacs discards +the oldest records from time to time (during @dfn{garbage +collection}). You can specify how much undo information to keep by setting the variables @code{undo-limit}, @code{undo-strong-limit}, and @code{undo-outer-limit}. Their values are expressed in bytes. @@ -193,7 +191,7 @@ point forward across three other characters. It would change @samp{f@point{}oobar} into @samp{oobf@point{}ar}. This is equivalent to repeating @kbd{C-t} three times. @kbd{C-u - 4 M-t} moves the word before point backward across four words. @kbd{C-u - C-M-t} would cancel -the effect of plain @kbd{C-M-t}.@refill +the effect of plain @kbd{C-M-t}. A numeric argument of zero is assigned a special meaning (because otherwise a command with a repeat count of zero would do nothing): to @@ -219,7 +217,7 @@ Convert last word to lower case with capital initial. the word case-conversion commands @kbd{M-l}, @kbd{M-u} and @kbd{M-c} have a special feature when used with a negative argument: they do not move the cursor. As soon as you see you have mistyped the last word, you can simply -case-convert it and go on typing. @xref{Case}.@refill +case-convert it and go on typing. @xref{Case}. @node Spelling @section Checking and Correcting Spelling @@ -230,18 +228,19 @@ case-convert it and go on typing. @xref{Case}.@refill 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 the spelling checker program Aspell, Ispell or Hunspell is installed. -Aspell, Ispell or Hunspell are not part of Emacs, but one or the other -is usually installed in GNU/Linux and other free operating systems. +These programs are not part of Emacs, but one of them is usually +installed in GNU/Linux and other free operating systems. @ifnottex @xref{Top, Aspell,, aspell, The Aspell Manual}. @end ifnottex @table @kbd @item M-$ -Check and correct spelling of the active region or the word at point -(@code{ispell-word}). +Check and correct spelling of the word at point (@code{ispell-word}). +If the region is active, do it for all words in the region instead. @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 Check and correct spelling in the buffer. @item M-x ispell-region @@ -270,7 +269,7 @@ optionally correct it as well, type @kbd{M-$} (@code{ispell-word}). If a region is active, @kbd{M-$} checks the spelling of all words within the region. @xref{Mark}. (When Transient Mark mode is off, @kbd{M-$} always acts on the word around or before point, ignoring the -region. @xref{Persistent Mark}.) +region; @pxref{Disabled Transient Mark}.) @findex ispell @findex ispell-buffer @@ -287,7 +286,7 @@ messages. @xref{Sending Mail}. When one of these commands encounters what appears to be an incorrect word, it asks you what to do. It usually displays a list of -numbered ``near-misses''---words that are close to the incorrect word. +numbered @dfn{near-misses}---words that are close to the incorrect word. Then you must type a single-character response. Here are the valid responses: @@ -332,7 +331,7 @@ file. @item l @var{word} @key{RET} Look in the dictionary for words that match @var{word}. These words -become the new list of ``near-misses''; you can select one of them as +become the new list of near-misses; you can select one of them as the replacement by typing a digit. You can use @samp{*} in @var{word} as a wildcard. @@ -354,14 +353,13 @@ Show the list of options. @end table @findex ispell-complete-word - In Text mode and related modes, the command @kbd{M-@key{TAB}} -(@code{ispell-complete-word}) shows a list of completions based on + In Text mode and related modes, @kbd{M-@key{TAB}} +(@code{ispell-complete-word}) performs in-buffer completion based on spelling correction. Insert the beginning of a word, and then type -@kbd{M-@key{TAB}}; the command displays a completion list window. (If -your 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, -click @kbd{Mouse-2} or @kbd{Mouse-1} fast on it, or move the cursor -there in the completions window and type @key{RET}. @xref{Text Mode}. +@kbd{M-@key{TAB}}; this shows a list of completions. (If your +window manager intercepts @kbd{M-@key{TAB}}, type @kbd{@key{ESC} +@key{TAB}} or @kbd{C-M-i}.) Each completion is listed with a digit or +character; type that digit or character to choose it. @cindex @code{ispell} program @findex ispell-kill-ispell @@ -369,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 commands complete more quickly. If you want to get rid of the process, use @kbd{M-x ispell-kill-ispell}. This is not usually -necessary, since the process uses no time except when you do spelling -correction. +necessary, since the process uses no processor time except when you do +spelling correction. @vindex ispell-dictionary @vindex ispell-local-dictionary @vindex ispell-personal-dictionary -@vindex ispell-complete-word-dict - Ispell, Aspell and Hunspell use two dictionaries together for spell checking: -the standard dictionary and your private dictionary. The standard -dictionary is specified by @code{ispell-local-dictionary} or, -if @code{nil}, by @code{ispell-dictionary}. If both are @code{nil} -the default dictionary is selected. The command -@kbd{M-x ispell-change-dictionary} sets the standard dictionary for -the buffer and then restarts the subprocess, so that it will use a -different standard dictionary. Personal dictionary is specified by -@code{ispell-personal-dictionary}. If @code{nil}, default value is -used. - - Set variable @code{ispell-dictionary} to select a specific default -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. +@findex ispell-change-dictionary + Ispell, Aspell and Hunspell look up spelling in two dictionaries: +the standard dictionary and your personal dictionary. The standard +dictionary is specified by the variable @code{ispell-local-dictionary} +or, if that is @code{nil}, by the variable @code{ispell-dictionary}. +If both are @code{nil}, the spelling program's default dictionary is +used. The command @kbd{M-x ispell-change-dictionary} sets the +standard dictionary for the buffer and then restarts the subprocess, +so that it will use a different standard dictionary. Your personal +dictionary is specified by the variable +@code{ispell-personal-dictionary}. If that is @code{nil}, the +spelling program looks for a personal dictionary in a default +location. +@vindex ispell-complete-word-dict A separate dictionary is used for word completion. The variable @code{ispell-complete-word-dict} specifies the file name of this dictionary. The completion dictionary must be different because it @@ -399,21 +395,26 @@ cannot use root and affix information. For some languages, there is a spell checking dictionary but no word completion dictionary. @cindex Flyspell mode +@cindex mode, Flyspell @findex flyspell-mode -@findex turn-on-flyspell - Flyspell mode is a fully-automatic way to check spelling as you edit -in Emacs. It operates by checking words as you change or insert them. -When it finds a word that it does not recognize, it highlights that -word. This does not interfere with your editing, but when you see the -highlighted word, you can move to it and fix it. Type @kbd{M-x -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}. - + Flyspell mode is a minor mode that performs automatic spell checking +as you type. When it finds a word that it does not recognize, it +highlights that word. Type @kbd{M-x flyspell-mode} to toggle Flyspell +mode in the current buffer. To enable Flyspell mode in all text mode +buffers, add @code{flyspell-mode} to @code{text-mode-hook}. +@xref{Hooks}. + +@findex flyspell-correct-word +@findex flyspell-auto-correct-word +@findex flyspell-correct-word-before-point 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 -actions. You can also correct the word by editing it manually in any -way you like. +it with @kbd{mouse-2} (@code{flyspell-correct-word}) to display a menu +of possible corrections and actions. In addition, @kbd{C-.} or +@kbd{@key{ESC}-@key{TAB}} (@code{flyspell-auto-correct-word}) will +propose various successive corrections for the word at point, and +@kbd{C-c $} (@code{flyspell-correct-word-before-point}) will pop up a +menu of possible corrections. Of course, you can always correct the +misspelled word by editing it manually in any way you like. @findex flyspell-prog-mode Flyspell Prog mode works just like ordinary Flyspell mode, except