3.3.1 Checking a Buffer
3.3.1 Checking a Buffer
Ispell includes options to check a buffer, a region, the comments in a program, or a single word. After you type the command telling Ispell what area you want to check, it works the same way for all these options. We'll describe ispell-buffer here. If all the words are spelled correctly, Ispell displays the message,
Spell-checking done. If Ispell finds a misspelled word, a screen like the following appears. Let's spell-check a hastily typed passage from Homer's Odyssey.
Type: Esc x ispell-buffer Enter
Ispell finds the first unrecognized word in the buffer.
Ispell moves to the first unrecognized word, in this case a proper name correctly spelled (except for the proper accent marks). At the top of the screen, Ispell opens a small window that displays alternative spellings, numbered starting with 0. The minibuffer says
C-h or ? for more options, SPC to leave unchanged, character to replace word. In this case, we have a properly spelled name, so press i to ask Ispell to insert it into your private dictionary, which is kept in a file called .ispell_<language> in your home directory, where language is the language you are using (English by default). If this file doesn't exist, Ispell creates it without complaint and later asks you if you want to save it. To insert the word in the dictionary in lowercase, press u and Ispell lowercases the word and then puts it into your dictionary. Of course, because this is a proper name, we insert it as it appears in the passage.
Ispell moves to the next unrecognized word, another proper name.
We insert a few more proper names and move along to the first real misspelling, pwers.
Ispell finds pwers misspelled.
Ispell opens a window at the top of the screen listing choices for a replacement. Usually one of its top few choices is correct.
To select powers, press: 1
Ispell replaces the word and goes on to the next misspelling.
If one of the words that Ispell lists at the top of the screen is correct, you type the number, and Ispell makes the replacement. To replace a word yourself, press r. After you type the corrected word, Ispell replaces it. If you press R instead, Ispell starts a query-replace through which you can correct all cases of the misspelling in this buffer.
Instead of replacing the word, you may simply want Ispell to skip over it. To skip this occurrence of a misspelled word, press Space. To ignore a misspelled word for the rest of the session for all buffers, press a (for accept). Uppercase A has one subtle difference: it tells Ispell to accept the word for this session but only in this buffer.
If you can see that something more complicated is wrong, you can start a recursive edit by typing C-r. Fix the error and type C-M-c to exit the recursive edit and resume Ispell. (You may recall that we discussed recursive editing earlier in this chapter.)
Our passage repeatedly spells would incorrectly and typing the character beside the correct word only replaces a single incidence, so a better choice would be to type R to query-replace the word throughout the buffer.
Ispell asks for the correction for wuld.
Change wuld to would and press Enter.
Ispell starts a query-replace.
We want to replace all occurrences of the misspelled word, so we'll type !, which, as you might recall, means "replace them all without asking."
Type ! then y when prompted about saving your personal dictionary.
Emacs moves to the "next" misspelling, crse.
Ispell replaces the words, then goes on to the next misspelling, crse. Note that this misspelling occurs before the second incorrect wuld. Because we already query-replaced wuld with would, Ispell had to move backward to find the next misspelling.
Remember that Ispell, like all spellcheckers, corrects only true misspellings. If a misspelling forms another word, Ispell will leave it alone. It's up to you to change fries to fires in this passage.
Different forms of the same word must be corrected separately. For example, if you misspell receive, receives, and receiving by reversing the i and the e, you must change each misspelled word.
- 3.3.4 Spellchecking on the Fly with Flyspell
- 3.3.2 Checking a Single Word
- Table E-8. Spell-checking commands
- Page buffers
- TCP REMOTE BUFFER
- DirectX Tutorial 4: Full Screen and Depth Buffers
- Checking for the Availability of the Loopback Interface
- Adding Some Error Checking
- Measuring Key Buffer Usage
- Checking Hardware Compatibility
- 9.2.2. Checking File System Integrity
- 14.5.2. Dumping the printk Log Buffer