[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

21.5 Checking and Correcting Spelling

This section describes the commands to check the spelling of a single word or of a portion of a buffer. These commands work with the spelling checker programs Aspell and Ispell, which are not part of Emacs. Voir Aspell: (aspell)Top section `Top' dans The Aspell Manual.

M-x flyspell-mode

Enable Flyspell mode, which highlights all misspelled words.

M-x flyspell-prog-mode

Enable Flyspell mode for comments and strings only.

M-$

Check and correct spelling of the word at point (ispell-word).

M-<TAB>
<ESC> <TAB>

Complete the word before point based on the spelling dictionary (ispell-complete-word).

M-x ispell

Spell-check the active region or the current buffer.

M-x ispell-buffer

Check and correct spelling of each word in the buffer.

M-x ispell-region

Check and correct spelling of each word in the region.

M-x ispell-message

Check and correct spelling of each word in a draft mail message, excluding cited material.

M-x ispell-change-dictionary <RET> dict <RET>

Restart the Aspell or Ispell process, using dict as the dictionary.

M-x ispell-kill-ispell

Kill the Aspell or Ispell subprocess.

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 M-x flyspell-mode to enable or disable this mode in the current buffer.

When Flyspell mode highlights a word as misspelled, you can click on it with 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.

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 M-x flyspell-prog-mode to enable or disable this mode in the current buffer.

The other Emacs spell-checking features check or look up words when you give an explicit command to do so.

To check the spelling of the word around or before point, and optionally correct it as well, use the command M-$ (ispell-word). If the word is not correct, the command offers you various alternatives for what to do about it.

To check the entire current buffer, use M-x ispell-buffer. Use M-x ispell-region to check just the current region. To check spelling in an email message you are writing, use M-x ispell-message; that command checks the whole buffer, except for material that is indented or appears to be cited from other messages.

The M-x ispell command spell-checks the active region if the Transient Mark mode is on (voir la section Transient Mark Mode), otherwise it spell-checks the current buffer.

Each time these commands encounter an incorrect word, they ask you what to do. They display a list of alternatives, usually including several “near-misses”—words that are close to the word being checked. Then you must type a single-character response. Here are the valid responses:

<SPC>

Skip this word—continue to consider it incorrect, but don't change it here.

r new <RET>

Replace the word (just this time) with new. (The replacement string will be rescanned for more spelling errors.)

R new <RET>

Replace the word with new, and do a query-replace so you can replace it elsewhere in the buffer if you wish. (The replacements will be rescanned for more spelling errors.)

digit

Replace the word (just this time) with one of the displayed near-misses. Each near-miss is listed with a digit; type that digit to select it.

a

Accept the incorrect word—treat it as correct, but only in this editing session.

A

Accept the incorrect word—treat it as correct, but only in this editing session and for this buffer.

i

Insert this word in your private dictionary file so that Aspell or Ispell will consider it correct from now on, even in future sessions.

u

Insert the lower-case version of this word in your private dictionary file.

m

Like i, but you can also specify dictionary completion information.

l word <RET>

Look in the dictionary for words that match word. These words become the new list of “near-misses”; you can select one of them as the replacement by typing a digit. You can use ‘*’ in word as a wildcard.

C-g

Quit interactive spell checking, leaving point at the word that was being checked. You can restart checking again afterward with C-u M-$.

X

Same as C-g.

x

Quit interactive spell checking and move point back to where it was when you started spell checking.

q

Quit interactive spell checking and kill the Ispell subprocess.

C-l

Refresh the screen.

C-z

This key has its normal command meaning (suspend Emacs or iconify this frame).

?

Show the list of options.

The command ispell-complete-word, which is bound to the key M-<TAB> in Text mode and related modes, shows a list of completions based on spelling correction. Insert the beginning of a word, and then type M-<TAB>; the command displays a completion list window. (If your window manager intercepts M-<TAB>, type <ESC> <TAB> or C-M-i.) To choose one of the completions listed, click Mouse-2 or Mouse-1 fast on it, or move the cursor there in the completions window and type <RET>. Voir la section Text Mode.

Once started, the Aspell or Ispell subprocess continues 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 M-x ispell-kill-ispell. This is not usually necessary, since the process uses no time except when you do spelling correction.

Ispell and Aspell use two dictionaries together for spell checking: the standard dictionary and your private dictionary. The variable ispell-dictionary specifies the file name to use for the standard dictionary; a value of nil selects the default dictionary. The command M-x ispell-change-dictionary sets this variable and then restarts the subprocess, so that it will use a different standard dictionary.

Aspell and Ispell use a separate dictionary for word completion. The variable 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.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 23 Février 2009 en utilisant texi2html 1.78.