diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-25 16:15:16 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-25 16:15:16 -0400 |
commit | 650c20f1ca4e07591a727e1cfcc74b3363d15985 (patch) | |
tree | 85d11f6437cde22f410c25e0e5f71a3131ebd07d /doc/emacs/fixit.texi | |
parent | 8869332684c2302b5ba1ead4568bbc7ba1c0183e (diff) | |
parent | 4b85ae6a24380fb67a3315eaec9233f17a872473 (diff) | |
download | emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.tar.gz emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.tar.bz2 emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.zip |
Merge 'master' into noverlay
Diffstat (limited to 'doc/emacs/fixit.texi')
-rw-r--r-- | doc/emacs/fixit.texi | 176 |
1 files changed, 114 insertions, 62 deletions
diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi index f2dba832522..d2704e25d67 100644 --- a/doc/emacs/fixit.texi +++ b/doc/emacs/fixit.texi @@ -1,5 +1,5 @@ @c This is part of the Emacs manual. -@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2017 Free Software +@c Copyright (C) 1985--1987, 1993--1995, 1997, 2001--2022 Free Software @c Foundation, Inc. @c See file emacs.texi for copying conditions. @node Fixit @@ -66,19 +66,21 @@ changes have already been undone, the undo command signals an error. @cindex redo @findex undo-only +@findex undo-redo Any command other than an undo command breaks the sequence of undo commands. Starting from that moment, the entire sequence of undo commands that you have just performed are themselves placed into the -undo record, as a single set of changes. Therefore, to re-apply -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. +undo record. Therefore, to re-apply changes you have undone, type +@kbd{C-f} or any other command that harmlessly breaks the sequence of +undoing; then type @kbd{C-/} one or more times to undo some of the +undo commands. 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. +@code{undo}, but will not redo changes you have just undone. To +complement it, @kbd{M-x undo-redo} will undo previous undo commands +(and will not record itself as an undoable command). -@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}). @@ -90,6 +92,10 @@ the last change you made undone, you will see whether it was an intentional change. If it was an accident, leave it undone. If it was deliberate, redo the change as described above. +Alternatively, you can discard all the changes since the buffer was +last visited or saved with @kbd{M-x revert-buffer} +(@pxref{Reverting}). + @cindex selective undo @kindex C-u C-/ When there is an active region, any use of @code{undo} performs @@ -119,14 +125,14 @@ setting the variables @code{undo-limit}, @code{undo-strong-limit}, and The variable @code{undo-limit} sets a soft limit: Emacs keeps undo data for enough commands to reach this size, and perhaps exceed it, but does not keep data for any earlier commands beyond that. Its -default value is 80000. The variable @code{undo-strong-limit} sets a +default value is 160000. The variable @code{undo-strong-limit} sets a stricter limit: any previous command (though not the most recent one) that pushes the size past this amount is forgotten. The default value -of @code{undo-strong-limit} is 120000. +of @code{undo-strong-limit} is 240000. Regardless of the values of those variables, the most recent change is never discarded unless it gets bigger than @code{undo-outer-limit} -(normally 12,000,000). At that point, Emacs discards the undo data and +(normally 24,000,000). At that point, Emacs discards the undo data and warns you about it. This is the only situation in which you cannot undo the last command. If this happens, you can increase the value of @code{undo-outer-limit} to make it even less likely to happen in the @@ -146,6 +152,12 @@ Transpose two words (@code{transpose-words}). Transpose two balanced expressions (@code{transpose-sexps}). @item C-x C-t Transpose two lines (@code{transpose-lines}). +@item M-x transpose-sentences +Transpose two sentences (@code{transpose-sentences}). +@item M-x transpose-paragraphs +Transpose two paragraphs (@code{transpose-paragraphs}). +@item M-x transpose-regions +Transpose two regions. @end table @kindex C-t @@ -159,9 +171,10 @@ last two characters on the line. So, if you catch your transposition error right away, you can fix it with just a @kbd{C-t}. If you don't catch it so fast, you must move the cursor back between the two transposed characters before you type @kbd{C-t}. If you transposed a space with -the last character of the word before it, the word motion commands are -a good way of getting there. Otherwise, a reverse search (@kbd{C-r}) -is often the best way. @xref{Search}. +the last character of the word before it, the word motion commands +(@kbd{M-f}, @kbd{M-b}, etc.) are a good way of getting there. +Otherwise, a reverse search (@kbd{C-r}) is often the best way. +@xref{Search}. @kindex C-x C-t @findex transpose-lines @@ -176,27 +189,42 @@ is often the best way. @xref{Search}. dragging the word preceding or containing point forward as well. The punctuation characters between the words do not move. For example, @w{@samp{FOO, BAR}} transposes into @w{@samp{BAR, FOO}} rather than -@samp{@w{BAR FOO,}}. +@w{@samp{BAR FOO,}}. When point is at the end of the line, it will +transpose the word before point with the first word on the next line. +@findex transpose-sentences +@findex transpose-paragraphs @kbd{C-M-t} (@code{transpose-sexps}) is a similar command for transposing two expressions (@pxref{Expressions}), and @kbd{C-x C-t} -(@code{transpose-lines}) exchanges lines. They work like @kbd{M-t} -except as regards what units of text they transpose. +(@code{transpose-lines}) exchanges lines. @kbd{M-x +transpose-sentences} and @kbd{M-x transpose-paragraphs} transpose +sentences and paragraphs, respectively. These commands work like +@kbd{M-t} except as regards the units of text they transpose. A numeric argument to a transpose command serves as a repeat count: it -tells the transpose command to move the character (word, expression, line) -before or containing point across several other characters (words, -expressions, lines). For example, @kbd{C-u 3 C-t} moves the character before -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}. +tells the transpose command to move the character (or word or +expression or line) before or containing point across several other +characters (or words or expressions or lines). For example, @w{@kbd{C-u +3 C-t}} moves the character before 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}. A numeric argument of zero is assigned a special meaning (because otherwise a command with a repeat count of zero would do nothing): to -transpose the character (word, expression, line) ending after point -with the one ending after the mark. +transpose the character (or word or expression or line) ending after +point with the one ending after the mark. + +@findex transpose-regions + @kbd{M-x transpose-regions} transposes the text between point and +mark with the text between the last two marks pushed to the mark ring +(@pxref{Setting Mark}). With a numeric prefix argument, it transposes +the text between point and mark with the text between two successive +marks that many entries back in the mark ring. This command is best +used for transposing multiple characters (or words or sentences or +paragraphs) in one go. @node Fixing Case @section Case Conversion @@ -214,7 +242,7 @@ Convert last word to lower case with capital initial. @kindex M-@t{-} M-u @kindex M-@t{-} M-c A very common error is to type words in the wrong case. Because of this, -the word case-conversion commands @kbd{M-l}, @kbd{M-u} and @kbd{M-c} have a +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}. @@ -227,13 +255,21 @@ case-convert it and go on typing. @xref{Case}. 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 Hunspell, Aspell, Ispell or Enchant is installed. -These programs are not part of Emacs, but one of them is usually -installed in GNU/Linux and other free operating systems. +a spelling checker program, one of Hunspell, Aspell, Ispell or +Enchant, is installed. These programs are not part of Emacs, but one +of them is usually installed on GNU/Linux and other free operating +systems. @ifnottex @xref{Top, Aspell,, aspell, The Aspell Manual}. @end ifnottex +@vindex ispell-program-name + If you have only one of the spelling checker programs installed, +Emacs will find it when you invoke for the first time one of the +commands described here. If you have more than one of them installed, +you can control which one is used by customizing the variable +@code{ispell-program-name}. + @table @kbd @item M-$ Check and correct spelling of the word at point (@code{ispell-word}). @@ -248,6 +284,10 @@ Check and correct spelling in the region. @item M-x ispell-message Check and correct spelling in a draft mail message, excluding cited material. +@item M-x ispell-comments-and-strings +Check and correct spelling of comments and strings in the buffer or region. +@item M-x ispell-comment-or-string-at-point +Check the comment or string at point. @item M-x ispell-change-dictionary @key{RET} @var{dict} @key{RET} Restart the spell-checker process, using @var{dict} as the dictionary. @item M-x ispell-kill-ispell @@ -275,15 +315,20 @@ region; @pxref{Disabled Transient Mark}.) @findex ispell @findex ispell-buffer @findex ispell-region +@findex ispell-comments-and-strings +@findex ispell-comment-or-string-at-point @cindex spell-checking the active region Similarly, the command @kbd{M-x ispell} performs spell-checking in the region if one is active, or in the entire buffer otherwise. The -commands @kbd{M-x ispell-buffer} and @kbd{M-x ispell-region} +commands @w{@kbd{M-x ispell-buffer}} and @w{@kbd{M-x ispell-region}} explicitly perform spell-checking on the entire buffer or the region respectively. To check spelling in an email message you are writing, -use @kbd{M-x ispell-message}; that command checks the whole buffer, +use @w{@kbd{M-x ispell-message}}; that command checks the whole buffer, except for material that is indented or appears to be cited from other -messages. @xref{Sending Mail}. +messages. @xref{Sending Mail}. When dealing with source code, you +can use @kbd{M-x ispell-comments-and-strings} or @w{@kbd{M-x +ispell-comment-or-string-at-point}} to check only comments or string +literals. 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 @@ -327,7 +372,7 @@ Like @kbd{i}, but you can also specify dictionary completion information. @item u -Insert the lower-case version of this word in your private dic@-tion@-ary +Insert the lower-case version of this word in your private dictionary file. @item l @var{word} @key{RET} @@ -338,16 +383,16 @@ wildcard. @item C-g @itemx X -Quit interactive spell checking, leaving point at the word that was -being checked. You can restart checking again afterward with @kbd{C-u -M-$}. +Quit interactive spell-checking, leaving point at the word that was +being checked. You can restart checking again afterward with @w{@kbd{C-u +M-$}}. @item x -Quit interactive spell checking and move point back to where it was -when you started spell checking. +Quit interactive spell-checking and move point back to where it was +when you started spell-checking. @item q -Quit interactive spell checking and kill the spell-checker subprocess. +Quit interactive spell-checking and kill the spell-checker subprocess. @item ? Show the list of options. @@ -358,16 +403,16 @@ Show the list of options. (@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}}; 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 +window manager intercepts @kbd{M-@key{TAB}}, type @w{@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 Once started, the spell-checker subprocess continues -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 -process, use @kbd{M-x ispell-kill-ispell}. This is not usually +process, use @w{@kbd{M-x ispell-kill-ispell}}. This is not usually necessary, since the process uses no processor time except when you do spelling correction. @@ -380,47 +425,54 @@ 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 +used. The command @w{@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. +location, which is specific to each spell-checker. @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 -cannot use root and affix information. For some languages, there -is a spell checking dictionary but no word completion dictionary. +cannot use the information about roots and affixes of the words, which +spell-checking uses to detect variations of words. For some +languages, there is a spell-checking dictionary but no word completion +dictionary. @cindex Flyspell mode @cindex mode, Flyspell @findex flyspell-mode - 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}. + Flyspell mode is a minor mode that performs automatic spell-checking +of the text you type as you type it. When it finds a word that it +does not recognize, it highlights that word. Type @w{@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}. Note +that, as Flyspell mode needs to check each word across which you move, +it will slow down cursor motion and scrolling commands. It also +doesn't automatically check the text you didn't type or move across; +use @code{flyspell-region} or @code{flyspell-buffer} for that. @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} (@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. +of possible corrections and actions. If you want this menu on +@kbd{mouse-3} instead, enable @code{context-menu-mode}. 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 +@w{@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 that it only checks words in comments and string constants. This -feature is useful for editing programs. Type @kbd{M-x -flyspell-prog-mode} to enable or disable this mode in the current +feature is useful for editing programs. Type @w{@kbd{M-x +flyspell-prog-mode}} to enable or disable this mode in the current buffer. To enable this mode in all programming mode buffers, add @code{flyspell-prog-mode} to @code{prog-mode-hook} (@pxref{Hooks}). |