Initial Commit
[packages] / xemacs-packages / ispell / ispell.texi
1 \input texinfo    @c -*-texinfo-*-
2 @comment %**start of header (This is for running Texinfo on a region.)
3 @setfilename ispell.info
4 @settitle ISPELL V3.1
5 @direntry
6 * Ispell::      Interactive spelling corrector.
7 @end direntry
8 @comment %**end of header (This is for running Texinfo on a region.)
9
10 @iftex
11 @finalout
12 @end iftex
13
14 @ifnottex
15 This file documents ISPELL, an interactive spelling corrector.
16
17 Copyright 1988, 1990, 1991, 1992, 1993  Free Software Foundation, Inc.
18
19 Permission is granted to make and distribute verbatim copies of
20 this manual provided the copyright notice and this permission notice
21 are preserved on all copies.
22
23 @ignore
24 Permission is granted to process this file through TeX and print the
25 results, provided the printed document carries copying permission
26 notice identical to this one except for the removal of this paragraph
27 (this paragraph not being relevant to the printed manual).
28
29 @end ignore
30 Permission is granted to copy and distribute modified versions of this
31 manual under the conditions for verbatim copying, provided that the entire
32 resulting derived work is distributed under the terms of a permission
33 notice identical to this one.
34
35 Permission is granted to copy and distribute translations of this manual
36 into another language, under the above conditions for modified versions,
37 except that this permission notice may be stated in a translation approved
38 by the Foundation.
39 @end ifnottex
40
41 @setchapternewpage odd
42 @titlepage
43 @sp 11
44 @center @titlefont{ISPELL}
45 @sp 2
46 @center by Pace Willisson and Geoff Kuenning
47 @sp 2
48 @center Version 3.1
49 @sp 2
50 @center December 1993
51
52 @comment   Include the Distribution inside the titlepage environment so
53 @c that headings are turned off. 
54
55 @page
56 @vskip 0pt plus 1filll
57 Copyright @copyright{} 1988, 1990, 1991, 1992, 1993  Free Software Foundation, Inc.
58
59 Published by Geoffrey H. Kuenning @*
60 12840 Winthrop Ave., @*
61 Granada Hills, CA  91344-1221 USA
62 @vskip 0pt plus 1filll
63
64 Permission is granted to make and distribute verbatim copies of
65 this manual provided the copyright notice and this permission notice
66 are preserved on all copies.
67
68 Permission is granted to copy and distribute modified versions of this
69 manual under the conditions for verbatim copying, provided that the entire
70 resulting derived work is distributed under the terms of a permission
71 notice identical to this one.
72
73 Permission is granted to copy and distribute translations of this manual
74 into another language, under the above conditions for modified versions,
75 except that this permission notice may be stated in a translation approved
76 by the Foundation.
77
78 @end titlepage
79 @node Top, Emacs, (dir), (dir)
80
81 @menu
82 * Emacs::                       Using ispell from emacs
83 * Old Emacs::                   Old Emacs
84 * Private::                     Your private dictionary
85 * Command summary::             All commands in emacs mode
86 * Near misses::                 Definition of a near miss
87 * History::                     Where it came from
88
89  --- The Detailed Node Listing ---
90
91 Using ispell from emacs
92
93 * Word::                        Checking a single word
94 * Buffer::                      Checking a whole buffer
95 * Region::                      Checking a region
96 * Multiple Dictionaries::       Using Multiple Dictionaries
97 @end menu
98
99
100 @iftex
101 @chapter ISPELL
102 @code{Ispell} is a program that helps you to correct spelling and
103 typographical errors in a file.  When presented with a word that is not
104 in the dictionary, @code{ispell} attempts to find @dfn{near misses} that
105 might include the word you meant.
106
107 This manual describes how to use @code{ispell} from within @code{emacs}.
108 Other information about @code{ispell} is available from the @code{Unix}
109 manual pages.
110 @end iftex
111
112 @ifnottex
113
114 @code{Ispell} is a program that helps you to correct spelling errors in
115 a file, and to find the correct spelling of words.  When presented with
116 a word that is not in the dictionary, @code{ispell} attempts to find
117 @dfn{near misses} that might include the word you meant.
118
119 This manual describes how to use ispell, as well as a little about
120 its implementation.
121
122 @end ifnottex
123
124 @menu
125 * Emacs::                       Using ispell from emacs
126 * Old Emacs::                   Old Emacs
127 * Private::                     Your private dictionary
128 * Command summary::             All commands in emacs mode
129 * Near misses::                 Definition of a near miss
130 * History::                     Where it came from
131
132 @end menu
133
134 @node Emacs, Old Emacs, Top, Top
135 @section Using ispell from emacs
136
137 @menu
138 * Word::                        Checking a single word
139 * Buffer::                      Checking a whole buffer
140 * Region::                      Checking a region
141 * Multiple Dictionaries::       Using Multiple Dictionaries
142 @end menu
143
144 @node Word, Buffer, Emacs, Emacs
145 @subsection Checking a single word
146
147 The simplest emacs command for calling ispell is 'M-$' (meta-dollar.  On
148 some terminals, you must type ESC-$.) This checks the spelling of the
149 word under the cursor.  If the word is found in the dictionary, then a
150 message is printed in the echo area.  Otherwise, ISPELL attempts to
151 generate near misses.
152
153 If any near misses are found, they are displayed in a separate window,
154 each preceded by a digit or character.  If one of these is the word you
155 wanted, just type its digit or character, and it will replace the
156 original word in your buffer.
157
158 If no near miss is right, or if none are displayed, you have five
159 choices:
160
161 @table @kbd
162 @item I
163
164 Insert the word in your private dictionary.  Use this if you know that
165 the word is spelled correctly.
166
167 @item A
168
169 Accept the word for the duration of this editing session, but do not put
170 it in your private dictionary.  Use this if you are not sure about the
171 spelling of the word, but you do not want to look it up immediately, or
172 for terms that appear in your document but are not truly words.  The
173 next time you start ispell, it will have forgotten any accepted words.
174
175 @item SPC
176
177 Leave the word alone, and consider it misspelled if it is checked again. 
178
179 @item R
180
181 Replace the word.  This command prompts you for a string in the
182 minibuffer.  You may type more than one word, and each word you type
183 is checked again, possibly finding other near misses.  This command
184 provides a handy way to close in on a word that you have no idea how
185 to spell.  You can keep trying different spellings until you find one
186 that is close enough to get a near miss. 
187
188 @item L
189
190 Lookup.  Display words from the dictionary that contain a 
191 specified substring.  The substring is a regular expression,
192 which means it can contain special characters to be more 
193 selective about which words get displayed.
194 @xref{Regexps, Regexps, Regexps, emacs, emacs}. @refill
195
196 If the only special character in the regular expression is a leading
197 @code{^}, then a very fast binary search will be used, instead of
198 scanning the whole file.
199
200 Only a few matching words can be displayed in the ISPELL window.
201 If you want to see more, use the @code{look} program directly from 
202 the shell.
203 @end table
204
205 Of course, you can also type @kbd{C-g} to stop the command without
206 changing anything.
207
208 If you make a change that you don't like, just use emacs' normal undo
209 feature @xref{undo, undo, undo, emacs, emacs}.
210
211 @node Buffer, Region, Word, Emacs
212 @subsection Checking a whole buffer
213
214 If you want to check the spelling of all the words in a buffer, type
215 the command @kbd{M-x ispell-buffer}.  This command scans the file, and makes
216 a list of all the misspelled words.  When it is done, it moves the
217 cursor to the first word on the list, and acts like you just typed M-$
218 @xref{Word}.
219
220 When you finish with one word, the cursor is automatically moved to the
221 next.  If you want to stop in the middle of the list type @kbd{X} or
222 @kbd{C-g}.
223
224 @node Region, Multiple Dictionaries, Buffer, Emacs
225 @subsection Checking a region
226
227 You may check the words in the region with the command @kbd{M-x ispell-region}.
228 See @xref{mark, mark, mark, emacs, emacs}.
229
230 The commands available are the same as for checking a whole buffer.
231
232 @node Multiple Dictionaries,  , Region, Emacs
233 @subsection Using Multiple Dictionaries
234
235 Your site may have multiple dictionaries installed: a default one
236 (usually @file{english.hash}), and several others for different
237 languages (e.g. @file{deutsch.hash}) or variations on a language (such as
238 British spelling for English).  
239
240 @table @code
241
242 @item ispell-change-dictionary
243 @findex ispell-change-dictionary
244
245 This is the command to change the dictionary.  It prompts for a new
246 dictionary name, with completion on the elements of @code{ispell-dictionary}.
247
248 It changes @code{ispell-dictionary} and kills the old ispell process, if
249 one was running.  A new one will be started as soon as necessary.
250
251 By just answering @kbd{RET} you can find out what the current dictionary
252 is.
253
254 @item ispell-dictionary
255 @vindex ispell-dictionary
256
257 If non-nil, a dictionary to use instead of the default one.
258 This is passed to the ispell process using the @code{-d} switch and is
259 used as key in @code{ispell-dictionary-alist}.
260
261 You should set this variable before your first call to ispell (e.g. in
262 your @file{.emacs}), or use the @kbd{M-x ispell-change-dictionary}
263 command to change it, as changing this variable only takes effect in a
264 newly started ispell process.
265
266 @item ispell-dictionary-alist
267 @vindex ispell-dictionary-alist
268
269 An alist of dictionaries and their associated parameters.
270
271 Each element of this list is also a list:
272
273 @example
274 (@var{dictionary-name}
275     @var{casechars} @var{not-casechars} @var{otherchars} @var{many-otherchars-p}
276     @var{ispell-args})
277 @end example
278
279 @var{dictionary-name} is a possible value of variable
280 @code{ispell-dictionary}, @code{nil} means the default dictionary.
281
282 @var{casechars} is a regular expression of valid characters that
283 comprise a word.
284
285 @var{not-casechars} is the opposite regexp of @var{casechars}.
286
287 @var{otherchars} is a regular expression of other characters that are
288 valid in word constructs.  Otherchars cannot be adjacent to each other
289 in a word, nor can they begin or end a word.  This implies we can't
290 check @samp{Stevens'} as a correct possessive and other correct
291 formations.
292
293 Hint: regexp syntax requires the hyphen to be declared first here.
294
295 @var{many-otherchars-p} is non-nil if many otherchars are to be allowed
296 in a word instead of only one.
297
298 @var{ispell-args} is a list of additional arguments passed to the ispell
299 subprocess.
300
301 Note that the @var{casechars} and @var{otherchars} slots of the alist should
302 contain the same character set as casechars and otherchars in the
303 @var{language}@file{.aff} file (e.g., @file{english.aff}).
304
305 @end table
306
307 @node Old Emacs, Private, Emacs, Top
308 @section Old Emacs
309
310 Until ispell becomes part of the standard emacs distribution, you will
311 have to explicitly request that it be loaded.  Put the following lines
312 in your emacs init file @xref{init file,, init file, emacs, emacs}.
313
314 @example
315 (autoload 'ispell-word "ispell" "Check the spelling of word in buffer." t)
316 (autoload 'ispell-region "ispell" "Check the spelling of region." t)
317 (autoload 'ispell-buffer "ispell" "Check the spelling of buffer." t)
318 (global-set-key "\e$" 'ispell-word)
319 @end example
320
321 (It will do no harm to have these lines in your init file even after
322 ispell is installed by default.)
323
324 @node Private, Command summary, Old Emacs, Top
325 @section Your private dictionary
326
327 Whenever ispell is started the file @file{.ispell_words} is read from
328 your home directory (if it exists).  This file contains a list of words,
329 one per line.  The order of the words is not important, but the case is.
330 Ispell will consider all of the words good, and will use them as
331 possible near misses.
332
333 The @kbd{I} command adds words to @file{.ispell_words}, so normally you
334 don't have to worry about the file.  You may want to check it from
335 time to time to make sure you have not accidentally inserted a
336 misspelled word.
337
338 @node Command summary, Near misses, Private, Top
339 @section All commands in emacs mode
340
341 @table @kbd
342 @item DIGIT
343 Select a near miss
344 @item I
345 Insert into private dictionary
346 @item A
347 Accept for this session
348 @item SPC
349 Skip this time
350 @item R
351 Replace with one or more words
352 @item L
353 Lookup: search the dictionary using a regular expression 
354 @item M-$
355 Check word
356 @item M-x ispell-buffer
357 Check buffer
358 @item M-x ispell-region
359 Check region
360 @item M-x ispell-change-dictionary
361 Select different dictionary.
362 @end table
363
364 @node Near misses, History, Command summary, Top
365 @section Definition of a near miss
366
367 Two words are near each other if they can be made identical with one
368 of the following changes to one of the words:
369
370 @example
371 Insert a blank space
372 Interchange two adjacent letters.
373 Change one letter.
374 Delete one letter.
375 Add one letter.
376 @end example
377
378 Someday, perhaps ispell will be extended so that words that sound
379 alike would also be considered near misses.  If you would like to
380 implement this, see Knuth, Volume 3, page 392 for a description of the
381 Soundex algorithm which might apply. 
382
383 @node History,  , Near misses, Top
384 @section Where it came from
385
386 Ispell has a long and convoluted history.  Originally called SPELL, it
387 was written by Ralph E. Gorin in 1971.  That version was written in
388 assembly language for the DEC PDP-10 to run under the WAITS operating
389 system at the Stanford Artificial Intelligence Laboratory.  Subsequent
390 versions, also in PDP-10 assembly language, were developed for the BBN
391 TENEX, MIT ITS, and DEC TOPS-10 and TOPS-20 operating systems.  It was
392 later revised by W. E. Matson (1974), and W. B. Ackerman (1978),
393 changing its name to ISPELL in the process.
394
395 In 1983, Pace Willisson (pace@@ai.mit.edu) converted this version to
396 the C language and modified it to work under Unix.
397
398 In 1987, Walt Buehring revised and enhanced ispell, and posted it to the
399 Usenet along with a dictionary.  In addition, Walt wrote the first version
400 of "ispell.el", the emacs interface.
401
402 Geoff Kuenning (geoff@@ITcorp.com, that's me, and by the way I pronounce
403 it "Kenning") picked up this version, fixed many bugs, and added further
404 enhancements.  In 1988 I got ambitious and rewrote major portions of the
405 code, resulting in the table-driven multi-lingual version.  Ken Stevens
406 (stevens@@hplabs.hp.com) made overwhelming contributions to the elisp
407 support to produce the version you are using now.
408
409 Due to a misunderstanding involving the Free Software Foundation, it
410 later became necessary to rename this version to ispell to avoid
411 confusion on the part of users.
412
413 Many other enhancements and bug fixes were provided by other people.
414 Although I omit mention here due to space, many of these people have
415 also made significant contributions to the version of ispell you see
416 here.  For a full list of people who have contributed to ispell, refer
417 to the file @file{Contributors} which is distributed with the ispell
418 sources.
419
420 @noindent
421 Geoff Kuenning @*
422 geoff@@ITcorp.com @*
423
424 @contents
425
426 @bye