Trailing whitespace deleted.
[emacs.git] / lisp / textmodes / ispell.el
blobc058dd18ac85d5d9a6f5c68ec77e4de7349262fc
1 ;;; ispell.el --- interface to International Ispell Versions 3.1 and 3.2
3 ;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
5 ;; Author: Ken Stevens <k.stevens@ieee.org>
6 ;; Maintainer: Ken Stevens <k.stevens@ieee.org>
7 ;; Stevens Mod Date: Fri Aug 4 09:41:50 PDT 2000
8 ;; Stevens Revision: 3.4
9 ;; Status : Release with 3.1.12+ and 3.2.0+ ispell.
10 ;; Bug Reports : ispell-el-bugs@itcorp.com
11 ;; Web Site : http://kdstevens.com/~stevens/ispell-page.html
12 ;; Keywords: unix wp
14 ;; This file is part of GNU Emacs.
16 ;; GNU Emacs is free software; you can redistribute it and/or modify
17 ;; it under the terms of the GNU General Public License as published by
18 ;; the Free Software Foundation; either version 2, or (at your option)
19 ;; any later version.
21 ;; GNU Emacs is distributed in the hope that it will be useful,
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;; GNU General Public License for more details.
26 ;; You should have received a copy of the GNU General Public License
27 ;; along with GNU Emacs; see the file COPYING. If not, write to the
28 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
29 ;; Boston, MA 02111-1307, USA.
31 ;; Note: version numbers and time stamp are not updated
32 ;; when this file is edited for release with GNU emacs.
34 ;;; Commentary:
36 ;; INSTRUCTIONS
38 ;; This code contains a section of user-settable variables that you
39 ;; should inspect prior to installation. Look past the end of the history
40 ;; list. Set them up for your locale and the preferences of the majority
41 ;; of the users. Otherwise the users may need to set a number of variables
42 ;; themselves.
43 ;; You particularly may want to change the default dictionary for your
44 ;; country and language.
45 ;; Most dictionary changes should be made in this file so all users can
46 ;; enjoy them. Local or modified dictionaries are supported in your .emacs
47 ;; file. Modify the variable `ispell-local-dictionary-alist' to include
48 ;; these dictionaries, and they will be installed when ispell.el is loaded.
50 ;; Depending on the mail system you use, you may want to include these:
51 ;; (add-hook 'news-inews-hook 'ispell-message)
52 ;; (add-hook 'mail-send-hook 'ispell-message)
53 ;; (add-hook 'mh-before-send-letter-hook 'ispell-message)
55 ;; Ispell has a TeX parser and a nroff parser (the default).
56 ;; The parsing is controlled by the variable ispell-parser. Currently
57 ;; it is just a "toggle" between TeX and nroff, but if more parsers are
58 ;; added it will be updated. See the variable description for more info.
61 ;; TABLE OF CONTENTS
63 ;; ispell-word
64 ;; ispell-region
65 ;; ispell-buffer
66 ;; ispell-message
67 ;; ispell-comments-and-strings
68 ;; ispell-continue
69 ;; ispell-complete-word
70 ;; ispell-complete-word-interior-frag
71 ;; ispell-change-dictionary
72 ;; ispell-kill-ispell
73 ;; ispell-pdict-save
74 ;; ispell-skip-region-alist
76 ;; Commands in ispell-region:
77 ;; Character replacement: Replace word with choice. May query-replace.
78 ;; ` ': Accept word this time.
79 ;; `i': Accept word and insert into private dictionary.
80 ;; `a': Accept word for this session.
81 ;; `A': Accept word and place in buffer-local dictionary.
82 ;; `r': Replace word with typed-in value. Rechecked.
83 ;; `R': Replace word with typed-in value. Query-replaced in buffer. Rechecked.
84 ;; `?': Show these commands
85 ;; `x': Exit spelling buffer. Move cursor to original point.
86 ;; `X': Exit spelling buffer. Leaves cursor at the current point, and permits
87 ;; the check to be completed later.
88 ;; `q': Quit spelling session (Kills ispell process).
89 ;; `l': Look up typed-in replacement in alternate dictionary. Wildcards okay.
90 ;; `u': Like `i', but the word is lower-cased first.
91 ;; `m': Place entered value in personal dictionary, then recheck current word.
92 ;; `C-l': redraws screen
93 ;; `C-r': recursive edit
94 ;; `C-z': suspend emacs or iconify frame
96 ;; Buffer-Local features:
97 ;; There are a number of buffer-local features that can be used to customize
98 ;; ispell for the current buffer. This includes language dictionaries,
99 ;; personal dictionaries, parsing, and local word spellings. Each of these
100 ;; local customizations are done either through local variables, or by
101 ;; including the keyword and argument(s) at the end of the buffer (usually
102 ;; prefixed by the comment characters). See the end of this file for
103 ;; examples. The local keywords and variables are:
105 ;; ispell-dictionary-keyword language-dictionary
106 ;; uses local variable ispell-local-dictionary
107 ;; ispell-pdict-keyword personal-dictionary
108 ;; uses local variable ispell-local-pdict
109 ;; ispell-parsing-keyword mode-arg extended-char-arg
110 ;; ispell-words-keyword any number of local word spellings
112 ;; Region skipping:
113 ;; Place new regular expression definitions of regions you prefer not to
114 ;; spell check in `ispell-skip-region-alist'. Mode-dependent features can
115 ;; be added to latex by modifying `ispell-tex-skip-alists'.
116 ;; `ispell-message' contains some custom skipping code for e-mail messages.
118 ;; BUGS:
119 ;; Need a way to select between different character mappings without separate
120 ;; dictionary entries.
121 ;; Multi-byte characters if not defined by current dictionary may result in the
122 ;; evil "misalignment error" in some versions of MULE emacs.
123 ;; On some versions of emacs, growing the minibuffer fails.
124 ;; see `ispell-help-in-bufferp'.
125 ;; Recursive edits (?C-r or ?R) inside a keyboard text replacement check (?r)
126 ;; can cause misalignment errors.
128 ;; HISTORY
130 ;; Modifications made in latest versions:
132 ;; Revision 3.4 2000/8/4 09:41:50 kss
133 ;; Support new color display functions.
134 ;; Fixed misalignment offset bug when replacing a string after a shift made.
135 ;; Set to standard Author/Maintainer heading,
136 ;; ensure localwords lists are separated from the text by newline. (Dave Love)
137 ;; Added dictionary definition for Italian (William Deakin)
138 ;; HTML region skipping greatly improved. (Chuck D. Phillips)
139 ;; improved menus. Fixed regexp matching http/email addresses.
140 ;; one arg always for xemacs sleep-for (gunnar Evermann)
141 ;; support for synchronous processes (Eli Zaretskii)
143 ;; Revision 3.3 1999/11/29 11:38:34 kss
144 ;; Only word replacements entered in from the keyboard are rechecked.
145 ;; This fixes a bug in tex parsing and misalignment.
146 ;; Exceptions exist for recursive edit and query-replace, with tex error
147 ;; condition tested. Recursive editing improved.
148 ;; XEmacs repair for when `enable-multibyte-characters' defined - Didier Verna.
149 ;; ispell-help fixed for XEmacs. Choices minibuffer now displayed in XEmacs.
150 ;; Only list valid dictionaries in Spell menu. Russian dictionary doesn't allow
151 ;; run-together words, and uses koi8-r font. Don't skip text in html <TT>
152 ;; fonts.
154 ;; Revision 3.2 1999/5/7 14:25:14 kss
155 ;; Accept ispell versions 3.X.Y where X>=1
156 ;; fine tuned latex region skipping. Fixed bug in ispell-word that did not
157 ;; point in right place on words < 2 chars. Simplified ispell-minor-mode.
158 ;; Fixed bug in TeX parsing when math commands are in the comments.
159 ;; Removed calls to `when' macro.
161 ;; Revision 3.1 1998/12/1 13:21:52 kss
162 ;; Improved and fixed customize support.
163 ;; Improved and fixed comments in variables and messages.
164 ;; A coding system is now required for all languages.
165 ;; casechars improved for castellano, castellano8, and norsk dictionaries.
166 ;; Dictionary norsk7-tex removed. Dictionary polish added.
167 ;; Dictionaries redefined at load-time to support dictionary changes.
168 ;; Menu redefined at load time to support dictionary changes.
169 ;; ispell-check-version added as an alias for `check-ispell-version'.
170 ;; Spelling suggestions returned in order generated by ispell.
171 ;; Small bug fixed in matching ispell error messages.
172 ;; Robustness added to ensure `case-fold-search' doesn't get redefined.
173 ;; Fixed bug that didn't respect case of word in `ispell-complete-word'.
174 ;; Multibyte character coding support added for process interactions.
175 ;; Ensure ispell process has terminated before starting new process.
176 ;; This can otherwise confuse process filters and hang ispell.
177 ;; Improved skipping support for SGML.
178 ;; Fixed bug using ^M rather than \r in `ispell-minor-check'.
179 ;; Improved message reference matching in `ispell-message'.
180 ;; Fixed bug in returning to nroff mode from tex mode.
183 ;;; Code:
185 ;;; Custom.el macros require recompiling this when they are not present.
186 ;;; Add in backward compatible custom support.
187 (eval-when-compile
188 (if (not (fboundp 'defcustom))
189 (defmacro defcustom (symbol value doc &rest args)
190 "Empty replacement for defcustom when not supplied."
191 `(defvar ,symbol ,value ,doc))))
193 (eval-when-compile
194 (if (not (fboundp 'defgroup))
195 (defmacro defgroup (&rest args)
196 "Empty replacement for defgroup when not supplied.")))
198 (defgroup ispell nil
199 "User variables for emacs ispell interface."
200 :group 'applications)
202 (if (not (fboundp 'buffer-substring-no-properties))
203 (defun buffer-substring-no-properties (start end)
204 (buffer-substring start end)))
206 ;;;###autoload
207 (defconst xemacsp (string-match "Lucid\\|XEmacs" emacs-version)
208 "Non nil if using XEmacs.")
210 (defconst ispell-graphic-p
211 (if (fboundp 'display-graphic-p)
212 (display-graphic-p)
213 xemacsp)
214 "True if running on a `graphics capable' display.")
216 (defalias 'ispell-check-version 'check-ispell-version)
218 ;;; **********************************************************************
219 ;;; The following variables should be set according to personal preference
220 ;;; and location of binaries:
221 ;;; **********************************************************************
224 ;;; ******* THIS FILE IS WRITTEN FOR ISPELL VERSION 3.1+
226 (defcustom ispell-highlight-p 'block
227 "*Highlight spelling errors when non-nil.
228 When set to `block', assumes a block cursor with TTY displays."
229 :type '(choice (const block) (const :tag "off" nil) (const :tag "on" t))
230 :group 'ispell)
232 (defcustom ispell-highlight-face 'highlight
233 "*The face used for Ispell highlighting. For Emacses with overlays.
234 Possible values are `highlight', `modeline', `secondary-selection',
235 `region', and `underline'.
236 This variable can be set by the user to whatever face they desire.
237 It's most convenient if the cursor color and highlight color are
238 slightly different."
239 :type 'face
240 :group 'ispell)
242 (defcustom ispell-check-comments t
243 "*Spelling of comments checked when non-nil.
244 When set to `exclusive', ONLY comments are checked. (For code comments).
245 Warning! Not checking comments, when a comment start is embedded in strings,
246 may produce undesired results."
247 :type '(choice (const exclusive) (const :tag "off" nil) (const :tag "on" t))
248 :group 'ispell)
250 (defcustom ispell-query-replace-choices nil
251 "*Corrections made throughout region when non-nil.
252 Uses `query-replace' (\\[query-replace]) for corrections."
253 :type 'boolean
254 :group 'ispell)
256 (defcustom ispell-skip-tib nil
257 "*Does not spell check `tib' bibliography references when non-nil.
258 Skips any text between strings matching regular expressions
259 `ispell-tib-ref-beginning' and `ispell-tib-ref-end'.
261 TeX users beware: Any field starting with [. will skip until a .] -- even
262 your whole buffer -- unless you set `ispell-skip-tib' to nil. That includes
263 a [.5mm] type of number...."
264 :type 'boolean
265 :group 'ispell)
267 (defvar ispell-tib-ref-beginning "[[<]\\."
268 "Regexp matching the beginning of a Tib reference.")
270 (defvar ispell-tib-ref-end "\\.[]>]"
271 "Regexp matching the end of a Tib reference.")
273 (defcustom ispell-keep-choices-win t
274 "*When not nil, the `*Choices*' window remains for spelling session.
275 This minimizes redisplay thrashing."
276 :type 'boolean
277 :group 'ispell)
279 (defcustom ispell-choices-win-default-height 2
280 "*The default size of the `*Choices*' window, including mode line.
281 Must be greater than 1."
282 :type 'integer
283 :group 'ispell)
285 (defcustom ispell-program-name "ispell"
286 "Program invoked by \\[ispell-word] and \\[ispell-region] commands."
287 :type 'string
288 :group 'ispell)
290 (defcustom ispell-alternate-dictionary
291 (cond ((file-exists-p "/usr/dict/web2") "/usr/dict/web2")
292 ((file-exists-p "/usr/share/dict/web2") "/usr/share/dict/web2")
293 ((file-exists-p "/usr/dict/words") "/usr/dict/words")
294 ((file-exists-p "/usr/lib/dict/words") "/usr/lib/dict/words")
295 ((file-exists-p "/usr/share/dict/words") "/usr/share/dict/words")
296 ((file-exists-p "/usr/share/lib/dict/words")
297 "/usr/share/lib/dict/words")
298 ((file-exists-p "/sys/dict") "/sys/dict")
299 (t "/usr/dict/words"))
300 "*Alternate dictionary for spelling help."
301 :type '(choice file (const :tag "None" nil))
302 :group 'ispell)
304 (defcustom ispell-complete-word-dict ispell-alternate-dictionary
305 "*Dictionary used for word completion."
306 :type '(choice file (const :tag "None" nil))
307 :group 'ispell)
309 (defcustom ispell-message-dictionary-alist nil
310 "*List used by `ispell-message' to select a new dictionary.
311 It consists of pairs (REGEXP . DICTIONARY). If REGEXP is found
312 in the message headers, `ispell-local-dictionary' will be set to
313 DICTIONARY if `ispell-local-dictionary' is not buffer-local.
314 E.g. you may use the following value:
315 '((\"^Newsgroups:[ \\t]*de\\\\.\" . \"deutsch8\")
316 (\"^To:[^\\n,]+\\\\.de[ \\t\\n,>]\" . \"deutsch8\"))"
317 :type '(repeat (cons regexp string))
318 :group 'ispell)
321 (defcustom ispell-grep-command "egrep"
322 "Name of the grep command for search processes."
323 :type 'string
324 :group 'ispell)
326 (defcustom ispell-grep-options "-i"
327 "String of options to use when running the program in `ispell-grep-command'.
328 Should probably be \"-i\" or \"-e\".
329 Some machines (like the NeXT) don't support \"-i\""
330 :type 'string
331 :group 'ispell)
333 (defcustom ispell-look-command
334 (cond ((file-exists-p "/bin/look") "/bin/look")
335 ((file-exists-p "/usr/local/bin/look") "/usr/local/bin/look")
336 ((file-exists-p "/usr/bin/look") "/usr/bin/look")
337 (t "look"))
338 "Name of the look command for search processes.
339 This must be an absolute file name."
340 :type 'file
341 :group 'ispell)
343 (defcustom ispell-look-p (file-exists-p ispell-look-command)
344 "*Non-nil means use `look' rather than `grep'.
345 Default is based on whether `look' seems to be available."
346 :type 'boolean
347 :group 'ispell)
349 (defcustom ispell-have-new-look nil
350 "*Non-nil means use the `-r' option (regexp) when running `look'."
351 :type 'boolean
352 :group 'ispell)
354 (defcustom ispell-look-options (if ispell-have-new-look "-dfr" "-df")
355 "String of command options for `ispell-look-command'."
356 :type 'string
357 :group 'ispell)
359 (defcustom ispell-use-ptys-p nil
360 "When non-nil, Emacs uses ptys to communicate with Ispell.
361 When nil, Emacs uses pipes."
362 :type 'boolean
363 :group 'ispell)
365 (defcustom ispell-following-word nil
366 "*Non-nil means `ispell-word' checks the word around or after point.
367 Otherwise `ispell-word' checks the preceding word."
368 :type 'boolean
369 :group 'ispell)
371 (defcustom ispell-help-in-bufferp nil
372 "*Non-nil means display interactive keymap help in a buffer.
373 The following values are supported:
374 nil Expand the minibuffer and display a short help message
375 there for a couple of seconds.
376 t Pop up a new buffer and display a short help message there
377 for a couple of seconds.
378 electric Pop up a new buffer and display a long help message there.
379 User can browse and then exit the help mode."
380 :type '(choice (const electric) (const :tag "off" nil) (const :tag "on" t))
381 :group 'ispell)
383 (defcustom ispell-quietly nil
384 "*Non-nil means suppress messages in `ispell-word'."
385 :type 'boolean
386 :group 'ispell)
388 (defcustom ispell-format-word (function upcase)
389 "*Formatting function for displaying word being spell checked.
390 The function must take one string argument and return a string."
391 :type 'function
392 :group 'ispell)
394 (defcustom ispell-use-framepop-p nil
395 "When non-nil ispell uses framepop to display choices in a dedicated frame.
396 You can set this variable to dynamically use framepop if you are in a
397 window system by evaluating the following on startup to set this variable:
398 (and window-system (condition-case () (require 'framepop) (error nil)))"
399 :type 'boolean
400 :group 'ispell)
402 ;;;###autoload
403 (defcustom ispell-personal-dictionary nil
404 "*File name of your personal spelling dictionary, or nil.
405 If nil, the default personal dictionary, \"~/.ispell_DICTNAME\" is used,
406 where DICTNAME is the name of your default dictionary."
407 :type '(choice file
408 (const :tag "default" nil))
409 :group 'ispell)
411 (defcustom ispell-silently-savep nil
412 "*When non-nil, save the personal dictionary without confirmation."
413 :type 'boolean
414 :group 'ispell)
416 ;;; This is the local dictionary to use. When nil the default dictionary will
417 ;;; be used. Change set-default call to use a new default dictionary.
418 (defcustom ispell-local-dictionary nil
419 "If non-nil, the dictionary to be used for Ispell commands.
420 The value must be a string dictionary name in `ispell-dictionary-alist'.
422 Setting `ispell-local-dictionary' to a value has the same effect as
423 calling \\[ispell-change-dictionary] with that value. This variable
424 is automatically set when defined in the file with either
425 `ispell-dictionary-keyword' or the Local Variable syntax.
427 To create a non-standard default dictionary (not from `ispell-dictionary-alist')
428 call function `set-default' with the new dictionary name."
429 :type '(choice string
430 (const :tag "default" nil))
431 :group 'ispell)
433 (make-variable-buffer-local 'ispell-local-dictionary)
435 ;; Call this function set up the default dictionary if not English.
436 ;;(set-default 'ispell-local-dictionary nil)
439 (defcustom ispell-extra-args nil
440 "*If non-nil, a list of extra switches to pass to the Ispell program.
441 For example, (\"-W\" \"3\") to cause it to accept all 1-3 character
442 words as correct. See also `ispell-dictionary-alist', which may be used
443 for language-specific arguments."
444 :type '(repeat string)
445 :group 'ispell)
449 (defcustom ispell-skip-html 'use-mode-name
450 "*Indicates whether ispell should skip spell checking of SGML markup.
451 If t, always skip SGML markup; if nil, never skip; if non-t and non-nil,
452 guess whether SGML markup should be skipped according to the name of the
453 buffer's major mode."
454 :type '(choice (const :tag "always" t) (const :tag "never" nil)
455 (const :tag "use-mode-name" use-mode-name))
456 :group 'ispell)
459 ;;; Define definitions here only for personal dictionaries.
460 ;;;###autoload
461 (defcustom ispell-local-dictionary-alist nil
462 "*Contains local or customized dictionary definitions.
463 See `ispell-dictionary-alist'."
464 :type '(repeat (list (choice :tag "Dictionary"
465 (string :tag "Dictionary name")
466 (const :tag "default" nil))
467 (regexp :tag "Case characters")
468 (regexp :tag "Non case characters")
469 (regexp :tag "Other characters")
470 (boolean :tag "Many other characters")
471 (repeat :tag "Ispell command line args"
472 (string :tag "Arg"))
473 (choice :tag "Extended character mode"
474 (const "~tex") (const "~plaintex")
475 (const "~nroff") (const "~list")
476 (const "~latin1") (const "~latin3")
477 (const :tag "default" nil))
478 (choice :tag "Character set"
479 (const iso-8859-1)
480 (const iso-8859-2)
481 (const koi8-r))))
482 :group 'ispell)
485 ;;; split dictionary so line length is smaller in loaddefs.el
487 ;;; First part of dictionary, shortened for loaddefs.el
488 ;;;###autoload
489 (setq
490 ispell-dictionary-alist-1
491 '((nil ; default (English.aff)
492 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
493 ("american" ; Yankee English
494 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
495 ("brasileiro" ; Brazilian mode
496 "[A-Z\301\311\315\323\332\300\310\314\322\331\303\325\307\334\302\312\324a-z\341\351\355\363\372\340\350\354\362\371\343\365\347\374\342\352\364]"
497 "[^A-Z\301\311\315\323\332\300\310\314\322\331\303\325\307\334\302\312\324a-z\341\351\355\363\372\340\350\354\362\371\343\365\347\374\342\352\364]"
498 "[']" nil ("-d" "brasileiro") nil iso-8859-1)
499 ("british" ; British version
500 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "british") nil iso-8859-1)
501 ("castellano" ; Spanish mode
502 "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
503 "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
504 "[-]" nil ("-B" "-d" "castellano") "~tex" iso-8859-1)
505 ("castellano8" ; 8 bit Spanish mode
506 "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
507 "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
508 "[-]" nil ("-B" "-d" "castellano") "~latin1" iso-8859-1)))
511 ;;; Second part of dictionary, shortened for loaddefs.el
512 ;;;###autoload
513 (setq
514 ispell-dictionary-alist-2
515 '(("czech"
516 "[A-Za-z\301\311\314\315\323\332\331\335\256\251\310\330\317\253\322\341\351\354\355\363\372\371\375\276\271\350\370\357\273\362]"
517 "[^A-Za-z\301\311\314\315\323\332\331\335\256\251\310\330\317\253\322\341\351\354\355\363\372\371\375\276\271\350\370\357\273\362]"
518 "" nil ("-B" "-d" "czech") nil iso-8859-2)
519 ("dansk" ; Dansk.aff
520 "[A-Z\306\330\305a-z\346\370\345]" "[^A-Z\306\330\305a-z\346\370\345]"
521 "[']" nil ("-C") nil iso-8859-1)
522 ("deutsch" ; Deutsch.aff
523 "[a-zA-Z\"]" "[^a-zA-Z\"]" "[']" t ("-C") "~tex" iso-8859-1)
524 ("deutsch8"
525 "[a-zA-Z\304\326\334\344\366\337\374]"
526 "[^a-zA-Z\304\326\334\344\366\337\374]"
527 "[']" t ("-C" "-d" "deutsch") "~latin1" iso-8859-1)
528 ("english" ; make English explicitly selectable
529 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)))
532 ;;; Third part of dictionary, shortened for loaddefs.el
533 ;;;###autoload
534 (setq
535 ispell-dictionary-alist-3
536 '(("esperanto"
537 "[A-Za-z\246\254\266\274\306\330\335\336\346\370\375\376]"
538 "[^A-Za-z\246\254\266\274\306\330\335\336\346\370\375\376]"
539 "[-']" t ("-C") "~latin3" iso-8859-1)
540 ("esperanto-tex"
541 "[A-Za-z^\\]" "[^A-Za-z^\\]"
542 "[-'`\"]" t ("-C" "-d" "esperanto") "~tex" iso-8859-1)
543 ("francais7"
544 "[A-Za-z]" "[^A-Za-z]" "[`'^---]" t nil nil iso-8859-1)
545 ("francais" ; Francais.aff
546 "[A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]"
547 "[^A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]"
548 "[-']" t nil "~list" iso-8859-1)))
551 ;;; Fourth part of dictionary, shortened for loaddefs.el
552 ;;;###autoload
553 (setq
554 ispell-dictionary-alist-4
555 '(("francais-tex" ; Francais.aff
556 "[A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374\\]"
557 "[^A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374\\]"
558 "[-'^`\"]" t nil "~tex" iso-8859-1)
559 ("german" ; german.aff
560 "[a-zA-Z\"]" "[^a-zA-Z\"]" "[']" t ("-C") "~tex" iso-8859-1)
561 ("german8"
562 "[a-zA-Z\304\326\334\344\366\337\374]"
563 "[^a-zA-Z\304\326\334\344\366\337\374]"
564 "[']" t ("-C" "-d" "german") "~latin1" iso-8859-1)
565 ("italiano" ; Italian.aff
566 "[A-Z\300\301\310\311\314\315\322\323\331\332a-z\340\341\350\351\354\355\363\371\372]"
567 "[^A-Z\300\301\310\311\314\315\322\323\331\332a-z\340\341\350\351\354\355\363\371\372]"
568 "[-]" nil ("-B" "-d" "italian") "~tex" iso-8859-1)))
571 ;;; Fifth part of dictionary, shortened for loaddefs.el
572 ;;;###autoload
573 (setq
574 ispell-dictionary-alist-5
575 '(("nederlands" ; Nederlands.aff
576 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
577 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
578 "[']" t ("-C") nil iso-8859-1)
579 ("nederlands8" ; Dutch8.aff
580 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
581 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
582 "[']" t ("-C") nil iso-8859-1)
583 ("norsk" ; 8 bit Norwegian mode
584 "[A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]"
585 "[^A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]"
586 "[\"]" nil ("-d" "norsk") "~list" iso-8859-1)
587 ("norsk7-tex" ; 7 bit Norwegian TeX mode
588 "[A-Za-z{}\\'^`]" "[^A-Za-z{}\\'^`]"
589 "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1)))
592 ;;; Sixth part of dictionary, shortened for loaddefs.el
593 ;;;###autoload
594 (setq
595 ispell-dictionary-alist-6
596 ;; include Russian iso character set too?
597 ;; "[']" t ("-d" "russian") "~latin1" iso-8859-1
598 '(("polish" ; polish mode
599 "[A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"
600 "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"
601 "" nil ( "-d" "polish") nil iso-8859-2)
602 ("russian" ; Russian.aff (KOI8-R charset)
603 "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]"
604 "[^\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]"
605 "" nil ("-d" "russian") nil koi8-r)
606 ("svenska" ; Swedish mode
607 "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]"
608 "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]"
609 "[']" nil ("-C") "~list" iso-8859-1)
610 ("portugues"
611 "[a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
612 "[^a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
613 "[']" t ("-C" "-d" "portugues") "~latin1" iso-8859-1)
614 ("slovak"
615 "[A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]"
616 "[^A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]"
617 "" nil ("-B" "-d" "slovak") nil iso-8859-2)))
619 ;;;###autoload
620 (defcustom ispell-dictionary-alist
621 (append ispell-local-dictionary-alist ; dictionary customizations
622 ispell-dictionary-alist-1 ispell-dictionary-alist-2
623 ispell-dictionary-alist-3 ispell-dictionary-alist-4
624 ispell-dictionary-alist-5 ispell-dictionary-alist-6)
625 "An alist of dictionaries and their associated parameters.
627 Each element of this list is also a list:
629 \(DICTIONARY-NAME CASECHARS NOT-CASECHARS OTHERCHARS MANY-OTHERCHARS-P
630 ISPELL-ARGS EXTENDED-CHARACTER-MODE CHARACTER-SET\)
632 DICTIONARY-NAME is a possible string value of variable `ispell-dictionary',
633 nil means the default dictionary.
635 CASECHARS is a regular expression of valid characters that comprise a
636 word.
638 NOT-CASECHARS is the opposite regexp of CASECHARS.
640 OTHERCHARS is a regexp of characters in the NOT-CASECHARS set but which can be
641 used to construct words in some special way. If OTHERCHARS characters follow
642 and precede characters from CASECHARS, they are parsed as part of a word,
643 otherwise they become word-breaks. As an example in English, assume the
644 regular expression \"[']\" for OTHERCHARS. Then \"they're\" and
645 \"Steven's\" are parsed as single words including the \"'\" character, but
646 \"Stevens'\" does not include the quote character as part of the word.
647 If you want OTHERCHARS to be empty, use the empty string.
648 Hint: regexp syntax requires the hyphen to be declared first here.
650 MANY-OTHERCHARS-P is non-nil when multiple OTHERCHARS are allowed in a word.
651 Otherwise only a single OTHERCHARS character is allowed to be part of any
652 single word.
654 ISPELL-ARGS is a list of additional arguments passed to the ispell
655 subprocess.
657 EXTENDED-CHARACTER-MODE should be used when dictionaries are used which
658 have been configured in an Ispell affix file. (For example, umlauts
659 can be encoded as \\\"a, a\\\", \"a, ...) Defaults are ~tex and ~nroff
660 in English. This has the same effect as the command-line `-T' option.
661 The buffer Major Mode controls Ispell's parsing in tex or nroff mode,
662 but the dictionary can control the extended character mode.
663 Both defaults can be overruled in a buffer-local fashion. See
664 `ispell-parsing-keyword' for details on this.
666 CHARACTER-SET used for languages with multibyte characters.
668 Note that the CASECHARS and OTHERCHARS slots of the alist should
669 contain the same character set as casechars and otherchars in the
670 LANGUAGE.aff file \(e.g., english.aff\)."
671 :type '(repeat (list (choice :tag "Dictionary"
672 (string :tag "Dictionary name")
673 (const :tag "default" nil))
674 (regexp :tag "Case characters")
675 (regexp :tag "Non case characters")
676 (regexp :tag "Other characters")
677 (boolean :tag "Many other characters")
678 (repeat :tag "Ispell command line args"
679 (string :tag "Arg"))
680 (choice :tag "Extended character mode"
681 (const "~tex") (const "~plaintex")
682 (const "~nroff") (const "~list")
683 (const "~latin1") (const "~latin3")
684 (const :tag "default" nil))
685 (choice :tag "Character set"
686 (const iso-8859-1)
687 (const iso-8859-2)
688 (const koi8-r))))
689 :group 'ispell)
691 ;;; update the dictionaries at load time
692 (setq ispell-dictionary-alist
693 (append ispell-local-dictionary-alist ; dictionary customizations
694 ispell-dictionary-alist-1 ispell-dictionary-alist-2
695 ispell-dictionary-alist-3 ispell-dictionary-alist-4
696 ispell-dictionary-alist-5 ispell-dictionary-alist-6))
701 ;;; **********************************************************************
702 ;;; The following are used by ispell, and should not be changed.
703 ;;; **********************************************************************
707 ;;; The version must be 3.1 or greater for this version of ispell.el
708 ;;; There is an incompatibility between version 3.1.12 and lower versions.
709 (defconst ispell-required-version '(3 1 12)
710 "Ispell versions with which this version of ispell.el is known to work.")
711 (defvar ispell-offset -1
712 "Offset that maps protocol differences between ispell 3.1 versions.")
714 (defconst ispell-version "ispell.el 3.4 -- Fri Aug 4 09:41:50 PDT 2000")
717 (defun check-ispell-version (&optional interactivep)
718 "Ensure that `ispell-program-name' is valid and the correct version.
719 Returns version number if called interactively.
720 Otherwise returns the library directory name, if that is defined."
721 ;; This is a little wasteful as we actually launch ispell twice: once
722 ;; to make sure it's the right version, and once for real. But people
723 ;; get confused by version mismatches *all* the time (and I've got the
724 ;; email to prove it) so I think this is worthwhile. And the -v[ersion]
725 ;; option is the only way I can think of to do this that works with
726 ;; all versions, since versions earlier than 3.0.09 didn't identify
727 ;; themselves on startup.
728 (interactive "p")
729 (let ((case-fold-search-val case-fold-search)
730 ;; avoid bugs when syntax of `.' changes in various default modes
731 (default-major-mode 'fundamental-mode)
732 (default-directory temporary-file-directory)
733 result status)
734 (save-excursion
735 (let ((buf (get-buffer " *ispell-tmp*")))
736 (if buf (kill-buffer buf)))
737 (set-buffer (get-buffer-create " *ispell-tmp*"))
738 (erase-buffer)
739 (setq status (call-process
740 ispell-program-name nil t nil
741 ;; aspell doesn't accept the -vv switch.
742 (let ((case-fold-search
743 (memq system-type '(ms-dos windows-nt)))
744 (speller
745 (file-name-nondirectory ispell-program-name)))
746 ;; Assume anything that isn't `aspell' is Ispell.
747 (if (string-match "\\`aspell" speller) "-v" "-vv"))))
748 (goto-char (point-min))
749 (if interactivep
750 (progn
751 (end-of-line)
752 (setq result (concat (buffer-substring-no-properties (point-min)
753 (point))
754 ", "
755 ispell-version))
756 (message result))
757 ;; return library directory.
758 (if (re-search-forward "LIBDIR = \\\"\\([^ \t\n]*\\)\\\"" nil t)
759 (setq result (buffer-substring (match-beginning 1) (match-end 1)))))
760 (goto-char (point-min))
761 (if (not (memq status '(0 nil)))
762 (error "%s exited with %s %s" ispell-program-name
763 (if (stringp status) "signal" "code") status))
764 (setq case-fold-search t
765 status (re-search-forward
766 (concat "\\<\\("
767 (format "%d" (car ispell-required-version))
768 "\\)\\.\\([0-9]*\\)\\.\\([0-9]*\\)\\>")
769 nil t)
770 case-fold-search case-fold-search-val)
771 (if (or (not status) ; major version mismatch
772 (< (car (read-from-string (buffer-substring-no-properties
773 (match-beginning 2) (match-end 2))))
774 (car (cdr ispell-required-version)))) ; minor version mismatch
775 (error "%s version 3 release %d.%d.%d or greater is required"
776 ispell-program-name (car ispell-required-version)
777 (car (cdr ispell-required-version))
778 (car (cdr (cdr ispell-required-version))))
779 ;; check that it is the correct version.
780 (if (and (= (car (read-from-string (buffer-substring-no-properties
781 (match-beginning 2)(match-end 2))))
782 (car (cdr ispell-required-version)))
783 (< (car (read-from-string (buffer-substring-no-properties
784 (match-beginning 3)(match-end 3))))
785 (car (cdr (cdr ispell-required-version)))))
786 (setq ispell-offset 0)))
787 (kill-buffer (current-buffer)))
788 result))
792 ;;; The preparation of the menu bar menu must be autoloaded
793 ;;; because otherwise this file gets autoloaded every time Emacs starts
794 ;;; so that it can set up the menus and determine keyboard equivalents.
797 ;;;###autoload
798 (defvar ispell-menu-map nil "Key map for ispell menu.")
799 ;;; redo menu when loading ispell to get dictionary modifications
800 (setq ispell-menu-map nil)
802 ;;;###autoload
803 (defvar ispell-menu-xemacs nil
804 "Spelling menu for XEmacs.
805 If nil when package is loaded, a standard menu will be set,
806 and added as a submenu of the \"Edit\" menu.")
808 ;;; Break out XEmacs menu and split into several calls to avoid having
809 ;;; long lines in loaddefs.el. Detect need off following constant.
811 ;;; Set up dictionary
812 ;;;###autoload
813 (defvar ispell-menu-map-needed
814 ;; only needed when not version 18 and not XEmacs.
815 (and (not ispell-menu-map)
816 (not xemacsp)
817 'reload))
819 (defvar ispell-library-directory (condition-case ()
820 (check-ispell-version)
821 (error nil))
822 "Directory where ispell dictionaries reside.")
824 (defvar ispell-process nil
825 "The process object for Ispell.")
827 (defvar ispell-async-processp (and (fboundp 'kill-process)
828 (fboundp 'process-send-string)
829 (fboundp 'accept-process-output)
830 ;;(fboundp 'start-process)
831 ;;(fboundp 'set-process-filter)
832 ;;(fboundp 'process-kill-without-query)
834 "Non-nil means that the OS supports asynchronous processes.")
836 ;;;###autoload
837 (if ispell-menu-map-needed
838 (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist)))
839 (dir (if (boundp 'ispell-library-directory) ispell-library-directory))
840 (dict-map (make-sparse-keymap "Dictionaries"))
841 name load-dict)
842 (setq ispell-menu-map (make-sparse-keymap "Spell"))
843 ;; add the dictionaries to the bottom of the list.
844 (dolist (dict dicts)
845 (setq name (car dict)
846 load-dict (car (cdr (member "-d" (nth 5 dict)))))
847 (unless (stringp name)
848 (define-key ispell-menu-map [default]
849 '("Select Default Dict"
850 "Dictionary for which Ispell was configured"
851 . (lambda () (interactive)
852 (ispell-change-dictionary "default"))))))
853 (fset 'ispell-dict-map dict-map)
854 (define-key ispell-menu-map [dictionaries]
855 `(menu-item "Select Dict" ispell-dict-map))
856 (dolist (dict dicts)
857 (setq name (car dict)
858 load-dict (car (cdr (member "-d" (nth 5 dict)))))
859 (cond ((not (stringp name)))
860 ((or (not dir) ; load all if library dir not defined
861 (file-exists-p (concat dir "/" name ".hash"))
862 (file-exists-p (concat dir "/" name ".has"))
863 (and load-dict
864 (or (file-exists-p (concat dir "/" load-dict ".hash"))
865 (file-exists-p (concat dir "/" load-dict ".has")))))
866 (define-key dict-map (vector (intern name))
867 (cons (concat "Select " (capitalize name) " Dict")
868 `(lambda () (interactive)
869 (ispell-change-dictionary ,name)))))))))
872 ;;; define commands in menu in opposite order you want them to appear.
873 ;;;###autoload
874 (if ispell-menu-map-needed
875 (progn
876 (define-key ispell-menu-map [ispell-change-dictionary]
877 '(menu-item "Change Dictionary..." ispell-change-dictionary
878 :help "Supply explicit dictionary file name"))
879 (define-key ispell-menu-map [ispell-kill-ispell]
880 '(menu-item "Kill Process" ispell-kill-ispell
881 :enable (and (boundp 'ispell-process) ispell-process
882 (eq (ispell-process-status) 'run))
883 :help "Terminate Ispell subprocess"))
884 (define-key ispell-menu-map [ispell-pdict-save]
885 '(menu-item "Save Dictionary"
886 (lambda () (interactive) (ispell-pdict-save t t))
887 :help "Save personal dictionary"))
888 (define-key ispell-menu-map [ispell-customize]
889 '(menu-item "Customize..."
890 (lambda () (interactive) (customize-group 'ispell))
891 :help "Customize spell checking options"))
892 (define-key ispell-menu-map [ispell-help]
893 ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ?
894 '(menu-item "Help"
895 (lambda () (interactive) (describe-function 'ispell-help))
896 :help "Show standard Ispell keybindings and commands"))
897 (define-key ispell-menu-map [flyspell-mode]
898 '(menu-item "Automatic spell checking (Flyspell)"
899 flyspell-mode
900 :help "Check spelling while you edit the text"
901 :button (:toggle . flyspell-mode)))
902 (define-key ispell-menu-map [ispell-complete-word]
903 '(menu-item "Complete Word" ispell-complete-word
904 :help "Complete word at cursor using dictionary"))
905 (define-key ispell-menu-map [ispell-complete-word-interior-frag]
906 '(menu-item "Complete Word Fragment" ispell-complete-word-interior-frag
907 :help "Complete word fragment at cursor"))))
909 ;;;###autoload
910 (if ispell-menu-map-needed
911 (progn
912 (define-key ispell-menu-map [ispell-continue]
913 '(menu-item "Continue Spell-Checking" ispell-continue
914 :enable (and (boundp 'ispell-region-end)
915 (marker-position ispell-region-end)
916 (equal (marker-buffer ispell-region-end)
917 (current-buffer)))
918 :help "Continue spell checking last region"))
919 (define-key ispell-menu-map [ispell-word]
920 '(menu-item "Spell-Check Word" ispell-word
921 :help "Spell-check word at cursor"))
922 (define-key ispell-menu-map [ispell-comments-and-strings]
923 '(menu-item "Spell-Check Comments" ispell-comments-and-strings
924 :help "Spell-check only comments and strings"))))
926 ;;;###autoload
927 (if ispell-menu-map-needed
928 (progn
929 (define-key ispell-menu-map [ispell-region]
930 '(menu-item "Spell-Check Region" ispell-region
931 :enable mark-active
932 :help "Spell-check text in marked region"))
933 (define-key ispell-menu-map [ispell-message]
934 '(menu-item "Spell-Check Message" ispell-message
935 :help "Skip headers and included message text"))
936 (define-key ispell-menu-map [ispell-buffer]
937 '(menu-item "Spell-Check Buffer" ispell-buffer
938 :help "Check spelling of selected buffer"))
939 ;;(put 'ispell-region 'menu-enable 'mark-active)
940 (fset 'ispell-menu-map (symbol-value 'ispell-menu-map))))
942 ;;; XEmacs versions 19 & 20
943 (if (and xemacsp
944 (featurep 'menubar)
945 (null ispell-menu-xemacs)
946 (not (and (boundp 'infodock-version) infodock-version)))
947 (let ((dicts (cons (cons "default" nil) ispell-dictionary-alist))
948 (current-menubar (or current-menubar default-menubar))
949 (menu
950 '(["Help" (describe-function 'ispell-help) t]
951 ;;["Help" (popup-menu ispell-help-list) t]
952 ["Check Message" ispell-message t]
953 ["Check Buffer" ispell-buffer t]
954 ["Check Comments" ispell-comments-and-strings t]
955 ["Check Word" ispell-word t]
956 ["Check Region" ispell-region (or (not zmacs-regions) (mark))]
957 ["Continue Check" ispell-continue t]
958 ["Complete Word Frag"ispell-complete-word-interior-frag t]
959 ["Complete Word" ispell-complete-word t]
960 ["Kill Process" ispell-kill-ispell t]
962 ["Save Personal Dict"(ispell-pdict-save t t) t]
963 ["Change Dictionary" ispell-change-dictionary t]
964 ["Select Default" (ispell-change-dictionary "default") t]))
965 name load-dict)
966 (while dicts
967 (setq name (car (car dicts))
968 load-dict (car (cdr (member "-d" (nth 5 (car dicts)))))
969 dicts (cdr dicts))
970 ;; Include if the dictionary is in the library, or dir not defined.
971 (if (and (stringp name)
972 (or (not ispell-library-directory)
973 (file-exists-p (concat ispell-library-directory "/"
974 name ".hash"))
975 (file-exists-p (concat ispell-library-directory "/"
976 name ".has"))
977 (and load-dict
978 (or (file-exists-p (concat ispell-library-directory "/"
979 load-dict ".hash"))
980 (file-exists-p (concat ispell-library-directory "/"
981 load-dict ".has"))))))
982 (setq menu (append menu
983 (list
984 (vector (concat "Select " (capitalize name))
985 (list 'ispell-change-dictionary name)
986 t))))))
987 (setq ispell-menu-xemacs menu)
988 (if current-menubar
989 (progn
990 (delete-menu-item '("Edit" "Spell")) ; in case already defined
991 (add-menu '("Edit") "Spell" ispell-menu-xemacs)))))
993 ;;; Allow incrementing characters as integers in XEmacs 20
994 (if (and xemacsp
995 (fboundp 'int-char))
996 (fset 'ispell-int-char 'int-char)
997 ;; Emacs and XEmacs 19 or earlier
998 (fset 'ispell-int-char 'identity))
1001 ;;; **********************************************************************
1004 ;;; This variable contains the current dictionary being used if the ispell
1005 ;;; process is running. Otherwise it contains the global default.
1006 (defvar ispell-dictionary nil
1007 "The name of the current dictionary, or nil for the default.
1008 When `ispell-local-dictionary' is nil, `ispell-dictionary' is used to select
1009 the dictionary for new buffers.
1011 This is passed to the ispell process using the `-d' switch and is
1012 used as key in `ispell-dictionary-alist' (which see).")
1014 (defun ispell-decode-string (str)
1015 "Decodes multibyte character strings.
1016 Protects against bogus binding of `enable-multibyte-characters' in XEmacs."
1017 (if (and (or xemacsp
1018 (and (boundp 'enable-multibyte-characters)
1019 enable-multibyte-characters))
1020 (fboundp 'decode-coding-string)
1021 (ispell-get-coding-system))
1022 (decode-coding-string str (ispell-get-coding-system))
1023 str))
1025 (defun ispell-get-casechars ()
1026 (ispell-decode-string
1027 (nth 1 (assoc ispell-dictionary ispell-dictionary-alist))))
1028 (defun ispell-get-not-casechars ()
1029 (ispell-decode-string
1030 (nth 2 (assoc ispell-dictionary ispell-dictionary-alist))))
1031 (defun ispell-get-otherchars ()
1032 (ispell-decode-string
1033 (nth 3 (assoc ispell-dictionary ispell-dictionary-alist))))
1034 (defun ispell-get-many-otherchars-p ()
1035 (nth 4 (assoc ispell-dictionary ispell-dictionary-alist)))
1036 (defun ispell-get-ispell-args ()
1037 (nth 5 (assoc ispell-dictionary ispell-dictionary-alist)))
1038 (defun ispell-get-extended-character-mode ()
1039 (nth 6 (assoc ispell-dictionary ispell-dictionary-alist)))
1040 (defun ispell-get-coding-system ()
1041 (nth 7 (assoc ispell-dictionary ispell-dictionary-alist)))
1044 (defvar ispell-pdict-modified-p nil
1045 "Non-nil means personal dictionary has modifications to be saved.")
1047 ;;; If you want to save the dictionary when quitting, must do so explicitly.
1048 ;;; When non-nil, the spell session is terminated.
1049 ;;; When numeric, contains cursor location in buffer, and cursor remains there.
1050 (defvar ispell-quit nil)
1052 (defvar ispell-process-directory nil
1053 "The directory where `ispell-process' was started.")
1055 (defvar ispell-filter nil
1056 "Output filter from piped calls to Ispell.")
1058 (defvar ispell-filter-continue nil
1059 "Control variable for Ispell filter function.")
1061 (defvar ispell-output-buffer nil
1062 "Buffer used for reading output of a synchronous Ispell subprocess.")
1064 (defvar ispell-session-buffer nil
1065 "Buffer used for passing input to a synchronous Ispell subprocess.")
1067 (defvar ispell-cmd-args nil
1068 "Command-line arguments to pass to a synchronous Ispell subprocess.")
1070 (defvar ispell-query-replace-marker (make-marker)
1071 "Marker for `query-replace' processing.")
1073 (defvar ispell-recursive-edit-marker (make-marker)
1074 "Marker for return point from recursive edit.")
1076 (defvar ispell-checking-message nil
1077 "Non-nil when we're checking a mail message.")
1079 (defconst ispell-choices-buffer "*Choices*")
1081 (defvar ispell-overlay nil "Overlay variable for Ispell highlighting.")
1083 ;;; *** Buffer Local Definitions ***
1085 (defconst ispell-words-keyword "LocalWords: "
1086 "The keyword for local oddly-spelled words to accept.
1087 The keyword will be followed by any number of local word spellings.
1088 There can be multiple of these keywords in the file.")
1090 (defconst ispell-dictionary-keyword "Local IspellDict: "
1091 "The keyword for a local dictionary to use.
1092 The keyword must be followed by a correct dictionary name in
1093 `ispell-dictionary-alist'. When multiple occurrences exist, the last keyword
1094 definition is used.")
1096 (defconst ispell-pdict-keyword "Local IspellPersDict: "
1097 "The keyword for defining buffer local dictionaries.
1098 Keyword must be followed by the filename of a personal dictionary.
1099 The last occurring definition in the buffer will be used.")
1101 (defconst ispell-parsing-keyword "Local IspellParsing: "
1102 "The keyword for overriding default Ispell parsing.
1103 The above keyword string should be followed by `latex-mode' or
1104 `nroff-mode' to put the current buffer into the desired parsing mode.
1106 Extended character mode can be changed for this buffer by placing
1107 a `~' followed by an extended-character mode -- such as `~.tex'.
1108 The last occurring definition in the buffer will be used.")
1110 ;;;###autoload
1111 (defvar ispell-skip-region-alist
1112 '((ispell-words-keyword forward-line)
1113 (ispell-dictionary-keyword forward-line)
1114 (ispell-pdict-keyword forward-line)
1115 (ispell-parsing-keyword forward-line)
1116 ("^---*BEGIN PGP [A-Z ]*--*" . "^---*END PGP [A-Z ]*--*")
1117 ("^---* \\(Start of \\)?[Ff]orwarded [Mm]essage" . "^---* End of [Ff]orwarded [Mm]essage")
1118 ;; Matches e-mail addresses, file names, http addresses, etc. The `-+'
1119 ;; pattern necessary for performance reasons when `-' part of word syntax.
1120 ("\\(-+\\|\\(/\\|\\(\\(\\w\\|[-_]\\)+[.:@]\\)\\)\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_]\\|~\\)+\\)+\\)")
1121 ;; This is a pretty complex regexp. It can be simplified to the following:
1122 ;; "\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_]\\|~\\)+\\)+"
1123 ;; but some valid text will be skipped, e.g. "his/her". This could be
1124 ;; fixed up (at the expense of a moderately more complex regexp)
1125 ;; by not allowing "/" to be the character which triggers the
1126 ;; identification of the computer name, e.g.:
1127 ;; "\\(\\w\\|[-_]\\)+[.:@]\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_]\\|~\\)+\\)+"
1129 "Alist expressing beginning and end of regions not to spell check.
1130 The alist key must be a regular expression.
1131 Valid forms include:
1132 (KEY) - just skip the key.
1133 (KEY . REGEXP) - skip to the end of REGEXP. REGEXP may be string or symbol.
1134 (KEY REGEXP) - skip to end of REGEXP. REGEXP must be a string.
1135 (KEY FUNCTION ARGS) - FUNCTION called with ARGS returns end of region.")
1139 ;;;###autoload
1140 (defvar ispell-tex-skip-alists
1141 '((;;("%\\[" . "%\\]") ; AMStex block comment...
1142 ;; All the standard LaTeX keywords from L. Lamport's guide:
1143 ;; \cite, \hspace, \hspace*, \hyphenation, \include, \includeonly, \input,
1144 ;; \label, \nocite, \rule (in ispell - rest included here)
1145 ("\\\\addcontentsline" ispell-tex-arg-end 2)
1146 ("\\\\add\\(tocontents\\|vspace\\)" ispell-tex-arg-end)
1147 ("\\\\\\([aA]lph\\|arabic\\)" ispell-tex-arg-end)
1148 ;;("\\\\author" ispell-tex-arg-end)
1149 ("\\\\bibliographystyle" ispell-tex-arg-end)
1150 ("\\\\makebox" ispell-tex-arg-end 0)
1151 ("\\\\e?psfig" ispell-tex-arg-end)
1152 ("\\\\document\\(class\\|style\\)" .
1153 "\\\\begin[ \t\n]*{[ \t\n]*document[ \t\n]*}"))
1154 (;; delimited with \begin. In ispell: displaymath, eqnarray, eqnarray*,
1155 ;; equation, minipage, picture, tabular, tabular* (ispell)
1156 ("\\(figure\\|table\\)\\*?" ispell-tex-arg-end 0)
1157 ("list" ispell-tex-arg-end 2)
1158 ("program" . "\\\\end[ \t\n]*{[ \t\n]*program[ \t\n]*}")
1159 ("verbatim\\*?" . "\\\\end[ \t\n]*{[ \t\n]*verbatim\\*?[ \t\n]*}")))
1160 "*Lists of regions to be skipped in TeX mode.
1161 First list is used raw.
1162 Second list has key placed inside \\begin{}.
1164 Delete or add any regions you want to be automatically selected
1165 for skipping in latex mode.")
1168 (defvar ispell-local-pdict ispell-personal-dictionary
1169 "A buffer local variable containing the current personal dictionary.
1170 If non-nil, the value must be a string, which is a file name.
1172 If you specify a personal dictionary for the current buffer which is
1173 different from the current personal dictionary, the effect is similar
1174 to calling \\[ispell-change-dictionary]. This variable is automatically
1175 set when defined in the file with either `ispell-pdict-keyword' or the
1176 local variable syntax.")
1178 (make-variable-buffer-local 'ispell-local-pdict)
1180 (defvar ispell-buffer-local-name nil
1181 "Contains the buffer name if local word definitions were used.
1182 Ispell is then restarted because the local words could conflict.")
1184 (defvar ispell-parser 'use-mode-name
1185 "*Indicates whether ispell should parse the current buffer as TeX Code.
1186 Special value `use-mode-name' tries to guess using the name of `major-mode'.
1187 Default parser is `nroff'.
1188 Currently the only other valid parser is `tex'.
1190 You can set this variable in hooks in your init file -- eg:
1192 (add-hook 'tex-mode-hook (function (lambda () (setq ispell-parser 'tex))))")
1194 (defvar ispell-region-end (make-marker)
1195 "Marker that allows spelling continuations.")
1197 (defvar ispell-check-only nil
1198 "If non-nil, `ispell-word' does not try to correct the word.")
1201 ;;; **********************************************************************
1202 ;;; **********************************************************************
1206 ;;;###autoload
1207 (define-key esc-map "$" 'ispell-word)
1210 (defun ispell-accept-output (&optional timeout-secs timeout-msecs)
1211 "Wait for output from ispell process, or TIMEOUT-SECS and TIMEOUT-MSECS.
1212 If asynchronous subprocesses are not supported, call `ispell-filter' and
1213 pass it the output of the last ispell invocation."
1214 (if ispell-async-processp
1215 (accept-process-output ispell-process timeout-secs timeout-msecs)
1216 (if (null ispell-process)
1217 (error "No Ispell process to read output from!")
1218 (let ((buf ispell-output-buffer)
1219 ispell-output)
1220 (if (not (bufferp buf))
1221 (setq ispell-filter nil)
1222 (save-excursion
1223 (set-buffer buf)
1224 (setq ispell-output (buffer-substring-no-properties
1225 (point-min) (point-max))))
1226 (ispell-filter t ispell-output)
1227 (save-excursion
1228 (set-buffer buf)
1229 (erase-buffer)))))))
1232 (defun ispell-send-string (string)
1233 "Send the string STRING to the Ispell process."
1234 (if ispell-async-processp
1235 (process-send-string ispell-process string)
1236 ;; Asynchronous subprocesses aren't supported on this losing system.
1237 ;; We keep all the directives passed to Ispell during the entire
1238 ;; session in a buffer, and pass them anew each time we invoke
1239 ;; Ispell to process another chunk of text. (Yes, I know this is a
1240 ;; terrible kludge, and it's a bit slow, but it does get the work done.)
1241 (let ((cmd (aref string 0))
1242 ;; The following commands are not passed to Ispell until
1243 ;; we have a *real* reason to invoke it.
1244 (cmds-to-defer '(?* ?@ ?~ ?+ ?- ?! ?%))
1245 (default-major-mode 'fundamental-mode)
1246 (session-buf ispell-session-buffer)
1247 (output-buf ispell-output-buffer)
1248 (ispell-args ispell-cmd-args)
1249 (defdir ispell-process-directory)
1250 prev-pos)
1251 (save-excursion
1252 (set-buffer session-buf)
1253 (setq prev-pos (point))
1254 (setq default-directory defdir)
1255 (insert string)
1256 (if (not (memq cmd cmds-to-defer))
1257 (let (coding-system-for-read coding-system-for-write status)
1258 (if (or xemacsp
1259 (and (boundp 'enable-multibyte-characters)
1260 enable-multibyte-characters))
1261 (setq coding-system-for-read (ispell-get-coding-system)
1262 coding-system-for-write (ispell-get-coding-system)))
1263 (set-buffer output-buf)
1264 (erase-buffer)
1265 (set-buffer session-buf)
1266 (setq status
1267 (apply 'call-process-region (point-min) (point-max)
1268 ispell-program-name nil
1269 output-buf nil
1270 "-a" "-m" ispell-args))
1271 (set-buffer output-buf)
1272 (goto-char (point-min))
1273 (save-match-data
1274 (if (not (looking-at "@(#) "))
1275 (error "Ispell error: %s"
1276 (buffer-substring-no-properties
1277 (point) (progn (end-of-line) (point)))))
1278 ;; If STRING is "^Z\n", we just started Ispell and need
1279 ;; to retain its version ID line in the output buffer.
1280 ;; Otherwise, remove the ID line, as it will confuse
1281 ;; `ispell-filter'.
1282 (or (string= string "\032\n")
1283 (progn
1284 (forward-line)
1285 (delete-region (point-min) (point))))
1286 ;; If STRING begins with ^ or any normal character, we need
1287 ;; to remove the last line from the session buffer, since it
1288 ;; was just spell-checked, and we don't want to check it again.
1289 ;; The same goes for the # command, since Ispell already saved
1290 ;; the personal dictionary.
1291 (set-buffer session-buf)
1292 (delete-region prev-pos (point))
1293 ;; Ispell run synchronously saves the personal dictionary
1294 ;; after each successful command. So we can remove any
1295 ;; lines in the session buffer that insert words into the
1296 ;; dictionary.
1297 (if (memq status '(0 nil))
1298 (let ((more-lines t))
1299 (goto-char (point-min))
1300 (while more-lines
1301 (if (looking-at "^\\*")
1302 (let ((start (point)))
1303 (forward-line)
1304 (delete-region start (point)))
1305 (setq more-lines (= 0 (forward-line))))))))))))))
1309 ;;;###autoload
1310 (defun ispell-word (&optional following quietly continue)
1311 "Check spelling of word under or before the cursor.
1312 If the word is not found in dictionary, display possible corrections
1313 in a window allowing you to choose one.
1315 If optional argument FOLLOWING is non-nil or if `ispell-following-word'
1316 is non-nil when called interactively, then the following word
1317 \(rather than preceding\) is checked when the cursor is not over a word.
1318 When the optional argument QUIETLY is non-nil or `ispell-quietly' is non-nil
1319 when called interactively, non-corrective messages are suppressed.
1321 With a prefix argument (or if CONTINUE is non-nil),
1322 resume interrupted spell-checking of a buffer or region.
1324 Word syntax described by `ispell-dictionary-alist' (which see).
1326 This will check or reload the dictionary. Use \\[ispell-change-dictionary]
1327 or \\[ispell-region] to update the Ispell process.
1329 return values:
1330 nil word is correct or spelling is accpeted.
1331 0 word is inserted into buffer-local definitions.
1332 \"word\" word corrected from word list.
1333 \(\"word\" arg\) word is hand entered.
1334 quit spell session exited."
1336 (interactive (list nil nil current-prefix-arg))
1337 (if continue
1338 (ispell-continue)
1339 (if (interactive-p)
1340 (setq following ispell-following-word
1341 quietly ispell-quietly))
1342 (ispell-accept-buffer-local-defs) ; use the correct dictionary
1343 (let ((cursor-location (point)) ; retain cursor location
1344 (word (ispell-get-word following))
1345 start end poss new-word replace)
1346 ;; De-structure return word info list.
1347 (setq start (car (cdr word))
1348 end (car (cdr (cdr word)))
1349 word (car word))
1351 ;; now check spelling of word if it has 3 or more characters.
1352 (cond
1353 ((> (length word) 2)
1354 (or quietly
1355 (message "Checking spelling of %s..."
1356 (funcall ispell-format-word word)))
1357 (ispell-send-string "%\n") ; put in verbose mode
1358 (ispell-send-string (concat "^" word "\n"))
1359 ;; wait until ispell has processed word
1360 (while (progn
1361 (ispell-accept-output)
1362 (not (string= "" (car ispell-filter)))))
1363 ;;(ispell-send-string "!\n") ;back to terse mode.
1364 (setq ispell-filter (cdr ispell-filter)) ; remove extra \n
1365 (if (and ispell-filter (listp ispell-filter))
1366 (if (> (length ispell-filter) 1)
1367 (error "Ispell and its process have different character maps")
1368 (setq poss (ispell-parse-output (car ispell-filter)))))
1369 (cond ((eq poss t)
1370 (or quietly
1371 (message "%s is correct"
1372 (funcall ispell-format-word word))))
1373 ((stringp poss)
1374 (or quietly
1375 (message "%s is correct because of root %s"
1376 (funcall ispell-format-word word)
1377 (funcall ispell-format-word poss))))
1378 ((null poss) (message "Error in ispell process"))
1379 (ispell-check-only ; called from ispell minor mode.
1380 (beep)
1381 (message "%s is incorrect" (funcall ispell-format-word word)))
1382 (t ; prompt for correct word.
1383 (save-window-excursion
1384 (setq replace (ispell-command-loop
1385 (car (cdr (cdr poss)))
1386 (car (cdr (cdr (cdr poss))))
1387 (car poss) start end)))
1388 (cond ((equal 0 replace)
1389 (ispell-add-per-file-word-list (car poss)))
1390 (replace
1391 (setq new-word (if (atom replace) replace (car replace))
1392 cursor-location (+ (- (length word) (- end start))
1393 cursor-location))
1394 (if (not (equal new-word (car poss)))
1395 (progn
1396 (delete-region start end)
1397 (setq start (point))
1398 (insert new-word)
1399 (setq end (point))))
1400 (if (not (atom replace)) ;recheck spelling of replacement
1401 (progn
1402 (if (car (cdr replace)) ; query replace requested
1403 (save-window-excursion
1404 (query-replace word new-word t)))
1405 (goto-char start)
1406 ;; single word could be split into multiple words
1407 (setq ispell-quit (not (ispell-region start end)))
1408 ))))
1409 ;; keep if rechecking word and we keep choices win.
1410 (if (get-buffer ispell-choices-buffer)
1411 (kill-buffer ispell-choices-buffer))))
1412 (ispell-pdict-save ispell-silently-savep)
1413 ;; NB: Cancels ispell-quit incorrectly if called from ispell-region
1414 (if ispell-quit (setq ispell-quit nil replace 'quit))))
1415 (goto-char cursor-location) ; return to original location
1416 replace)))
1419 (defun ispell-get-word (following &optional extra-otherchars)
1420 "Return the word for spell-checking according to ispell syntax.
1421 If optional argument FOLLOWING is non-nil or if `ispell-following-word'
1422 is non-nil when called interactively, then the following word
1423 \(rather than preceding\) is checked when the cursor is not over a word.
1424 Optional second argument contains otherchars that can be included in word
1425 many times.
1427 Word syntax described by `ispell-dictionary-alist' (which see)."
1428 (let* ((ispell-casechars (ispell-get-casechars))
1429 (ispell-not-casechars (ispell-get-not-casechars))
1430 (ispell-otherchars (ispell-get-otherchars))
1431 (ispell-many-otherchars-p (ispell-get-many-otherchars-p))
1432 (word-regexp (concat ispell-casechars
1433 "+\\("
1434 (if (not (string= "" ispell-otherchars))
1435 (concat ispell-otherchars "?"))
1436 (if extra-otherchars
1437 (concat extra-otherchars "?"))
1438 ispell-casechars
1439 "+\\)"
1440 (if (or ispell-many-otherchars-p
1441 extra-otherchars)
1442 "*" "?")))
1443 did-it-once prevpt
1444 start end word)
1445 ;; find the word
1446 (if (not (looking-at ispell-casechars))
1447 (if following
1448 (re-search-forward ispell-casechars (point-max) t)
1449 (re-search-backward ispell-casechars (point-min) t)))
1450 ;; move to front of word
1451 (re-search-backward ispell-not-casechars (point-min) 'start)
1452 (while (and (or (and (not (string= "" ispell-otherchars))
1453 (looking-at ispell-otherchars))
1454 (and extra-otherchars (looking-at extra-otherchars)))
1455 (not (bobp))
1456 (or (not did-it-once)
1457 ispell-many-otherchars-p)
1458 (not (eq prevpt (point))))
1459 (if (and extra-otherchars (looking-at extra-otherchars))
1460 (progn
1461 (backward-char 1)
1462 (if (looking-at ispell-casechars)
1463 (re-search-backward ispell-not-casechars (point-min) 'move)))
1464 (setq did-it-once t
1465 prevpt (point))
1466 (backward-char 1)
1467 (if (looking-at ispell-casechars)
1468 (re-search-backward ispell-not-casechars (point-min) 'move)
1469 (backward-char -1))))
1470 ;; Now mark the word and save to string.
1471 (if (not (re-search-forward word-regexp (point-max) t))
1472 (if ispell-check-only
1473 ;; return dummy word when just flagging misspellings
1474 (list "" (point) (point))
1475 (error "No word found to check!"))
1476 (setq start (match-beginning 0)
1477 end (point)
1478 word (buffer-substring-no-properties start end))
1479 (list word start end))))
1482 ;;; Global ispell-pdict-modified-p is set by ispell-command-loop and
1483 ;;; tracks changes in the dictionary. The global may either be
1484 ;;; a value or a list, whose value is the state of whether the
1485 ;;; dictionary needs to be saved.
1487 ;;;###autoload
1488 (defun ispell-pdict-save (&optional no-query force-save)
1489 "Check to see if the personal dictionary has been modified.
1490 If so, ask if it needs to be saved."
1491 (interactive (list ispell-silently-savep t))
1492 (if (and ispell-pdict-modified-p (listp ispell-pdict-modified-p))
1493 (setq ispell-pdict-modified-p (car ispell-pdict-modified-p)))
1494 (if (or ispell-pdict-modified-p force-save)
1495 (if (or no-query (y-or-n-p "Personal dictionary modified. Save? "))
1496 (progn
1497 (ispell-send-string "#\n") ; save dictionary
1498 (message "Personal dictionary saved."))))
1499 ;; unassert variable, even if not saved to avoid questioning.
1500 (setq ispell-pdict-modified-p nil))
1503 (defun ispell-command-loop (miss guess word start end)
1504 "Display possible corrections from list MISS.
1505 GUESS lists possibly valid affix construction of WORD.
1506 Returns nil to keep word.
1507 Returns 0 to insert locally into buffer-local dictionary.
1508 Returns string for new chosen word.
1509 Returns list for new replacement word (will be rechecked).
1510 Query-replace when list length is 2.
1511 Automatic query-replace when second element is `query-replace'.
1512 Highlights the word, which is assumed to run from START to END.
1513 Global `ispell-pdict-modified-p' becomes a list where the only value
1514 indicates whether the dictionary has been modified when option `a' or `i' is
1515 used.
1516 Global `ispell-quit' set to start location to continue spell session."
1517 (let ((count ?0)
1518 (line ispell-choices-win-default-height)
1519 ;; ensure 4 context lines.
1520 (max-lines (- (ispell-adjusted-window-height) 4))
1521 (choices miss)
1522 (window-min-height (min window-min-height
1523 ispell-choices-win-default-height))
1524 (command-characters '( ? ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m ))
1525 (dedicated (window-dedicated-p (selected-window)))
1526 (skipped 0)
1527 char num result textwin dedicated-win)
1529 ;; setup the *Choices* buffer with valid data.
1530 (save-excursion
1531 (set-buffer (get-buffer-create ispell-choices-buffer))
1532 (setq mode-line-format (concat "-- %b -- word: " word))
1533 ;; XEmacs: prevent thick modeline vs increasing height in overlay-window
1534 ;;(and (fboundp 'set-specifier)
1535 ;; (set-specifier has-modeline-p (cons (current-buffer) nil)))
1536 (erase-buffer)
1537 (if guess
1538 (progn
1539 (insert "Affix rules generate and capitalize "
1540 "this word as shown below:\n\t")
1541 (while guess
1542 (if (> (+ 4 (current-column) (length (car guess)))
1543 (window-width))
1544 (progn
1545 (insert "\n\t")
1546 (setq line (1+ line))))
1547 (insert (car guess) " ")
1548 (setq guess (cdr guess)))
1549 (insert "\nUse option `i' if this is a correct composition"
1550 " from the derivative root.\n")
1551 (setq line (+ line (if choices 3 2)))))
1552 (while (and choices
1553 (< (if (> (+ 7 (current-column) (length (car choices))
1554 (if (> count ?~) 3 0))
1555 (window-width))
1556 (progn
1557 (insert "\n")
1558 (setq line (1+ line)))
1559 line)
1560 max-lines))
1561 ;; not so good if there are over 20 or 30 options, but then, if
1562 ;; there are that many you don't want to scan them all anyway...
1563 (while (memq count command-characters) ; skip command characters.
1564 (setq count (ispell-int-char (1+ count))
1565 skipped (1+ skipped)))
1566 (insert "(" count ") " (car choices) " ")
1567 (setq choices (cdr choices)
1568 count (ispell-int-char (1+ count))))
1569 (setq count (ispell-int-char (- count ?0 skipped))))
1571 ;; ensure word is visible
1572 (if (not (pos-visible-in-window-p end))
1573 (sit-for 0))
1575 ;; allow temporary split of dedicated windows...
1576 (if dedicated
1577 (progn
1578 (setq dedicated-win (selected-window))
1579 (set-window-dedicated-p dedicated-win nil)))
1581 ;; Display choices for misspelled word.
1582 (ispell-show-choices line end)
1583 (select-window (setq textwin (next-window)))
1585 ;; highlight word, protecting current buffer status
1586 (unwind-protect
1587 (progn
1588 (and ispell-highlight-p
1589 (ispell-highlight-spelling-error start end t))
1590 ;; Loop until a valid choice is made.
1591 (while
1594 (setq
1595 result
1596 (progn
1597 (undo-boundary)
1598 (let (message-log-max)
1599 (message (concat "C-h or ? for more options; SPC to leave "
1600 "unchanged, Character to replace word")))
1601 (let ((inhibit-quit t))
1602 (setq char (if (fboundp 'read-char-exclusive)
1603 (read-char-exclusive)
1604 (read-char))
1605 skipped 0)
1606 (if (or quit-flag (= char ?\C-g)) ; C-g is like typing X
1607 (setq char ?X
1608 quit-flag nil)))
1609 ;; Adjust num to array offset skipping command characters.
1610 (let ((com-chars command-characters))
1611 (while com-chars
1612 (if (and (> (car com-chars) ?0) (< (car com-chars) char))
1613 (setq skipped (1+ skipped)))
1614 (setq com-chars (cdr com-chars)))
1615 (setq num (- char ?0 skipped)))
1617 (cond
1618 ((= char ? ) nil) ; accept word this time only
1619 ((= char ?i) ; accept and insert word into pers dict
1620 (ispell-send-string (concat "*" word "\n"))
1621 (setq ispell-pdict-modified-p '(t)) ; dictionary modified!
1622 nil)
1623 ((or (= char ?a) (= char ?A)) ; accept word without insert
1624 (ispell-send-string (concat "@" word "\n"))
1625 (if (null ispell-pdict-modified-p)
1626 (setq ispell-pdict-modified-p
1627 (list ispell-pdict-modified-p)))
1628 (if (= char ?A) 0)) ; return 0 for ispell-add buffer-local
1629 ((or (= char ?r) (= char ?R)) ; type in replacement
1630 (and (eq 'block ispell-highlight-p) ; refresh tty's
1631 (ispell-highlight-spelling-error start end nil t))
1632 (let ((result
1633 (if (or (= char ?R) ispell-query-replace-choices)
1634 (list (read-string
1635 (format "Query-replacement for %s: "word)
1636 word)
1638 (cons (read-string "Replacement for: " word)
1639 nil))))
1640 (and (eq 'block ispell-highlight-p)
1641 (ispell-highlight-spelling-error start end nil
1642 'block))
1643 result))
1644 ((or (= char ??) (= char help-char) (= char ?\C-h))
1645 (and (eq 'block ispell-highlight-p)
1646 (ispell-highlight-spelling-error start end nil t))
1647 (ispell-help)
1648 (and (eq 'block ispell-highlight-p)
1649 (ispell-highlight-spelling-error start end nil
1650 'block))
1652 ;; Quit and move point back.
1653 ((= char ?x)
1654 (ispell-pdict-save ispell-silently-savep)
1655 (message "Exited spell-checking")
1656 (setq ispell-quit t)
1657 nil)
1658 ;; Quit and preserve point.
1659 ((= char ?X)
1660 (ispell-pdict-save ispell-silently-savep)
1661 (message "%s"
1662 (substitute-command-keys
1663 (concat "Spell-checking suspended;"
1664 " use C-u \\[ispell-word] to resume")))
1665 (setq ispell-quit start)
1666 nil)
1667 ((= char ?q)
1668 (if (y-or-n-p "Really kill Ispell process? ")
1669 (progn
1670 (ispell-kill-ispell t) ; terminate process.
1671 (setq ispell-quit (or (not ispell-checking-message)
1672 (point))
1673 ispell-pdict-modified-p nil))
1674 t)) ; continue if they don't quit.
1675 ((= char ?l)
1676 (and (eq 'block ispell-highlight-p) ; refresh tty displays
1677 (ispell-highlight-spelling-error start end nil t))
1678 (let ((new-word (read-string
1679 "Lookup string (`*' is wildcard): "
1680 word)))
1681 (if new-word
1682 (progn
1683 (save-excursion
1684 (set-buffer (get-buffer-create
1685 ispell-choices-buffer))
1686 (erase-buffer)
1687 (setq count ?0
1688 skipped 0
1689 mode-line-format (concat
1690 "-- %b -- word: "
1691 new-word)
1692 miss (lookup-words new-word)
1693 choices miss
1694 line ispell-choices-win-default-height)
1695 (while (and choices ; adjust choices window.
1696 (< (if (> (+ 7 (current-column)
1697 (length (car choices))
1698 (if (> count ?~) 3 0))
1699 (window-width))
1700 (progn
1701 (insert "\n")
1702 (setq line (1+ line)))
1703 line)
1704 max-lines))
1705 (while (memq count command-characters)
1706 (setq count (ispell-int-char (1+ count))
1707 skipped (1+ skipped)))
1708 (insert "(" count ") " (car choices) " ")
1709 (setq choices (cdr choices)
1710 count (ispell-int-char (1+ count))))
1711 (setq count (ispell-int-char
1712 (- count ?0 skipped))))
1713 (ispell-show-choices line end)
1714 (select-window (next-window)))))
1715 (and (eq 'block ispell-highlight-p)
1716 (ispell-highlight-spelling-error start end nil
1717 'block))
1718 t) ; reselect from new choices
1719 ((= char ?u) ; insert lowercase into dictionary
1720 (ispell-send-string (concat "*" (downcase word) "\n"))
1721 (setq ispell-pdict-modified-p '(t)) ; dictionary modified!
1722 nil)
1723 ((= char ?m) ; type in what to insert
1724 (ispell-send-string
1725 (concat "*" (read-string "Insert: " word) "\n"))
1726 (setq ispell-pdict-modified-p '(t))
1727 (cons word nil))
1728 ((and (>= num 0) (< num count))
1729 (if ispell-query-replace-choices ; Query replace flag
1730 (list (nth num miss) 'query-replace)
1731 (nth num miss)))
1732 ((= char ?\C-l)
1733 (redraw-display) t)
1734 ((= char ?\C-r)
1735 ;; This may have alignment errors if current line is edited
1736 (if (marker-position ispell-recursive-edit-marker)
1737 (progn
1738 (message "Only one recursive edit session supported")
1739 (beep)
1740 (sit-for 2))
1741 (set-marker ispell-recursive-edit-marker start)
1742 ;;(set-marker ispell-region-end reg-end)
1743 (and ispell-highlight-p ; unhighlight
1744 (ispell-highlight-spelling-error start end))
1745 (unwind-protect
1746 (progn
1747 (message
1748 "%s"
1749 (substitute-command-keys
1750 (concat "Exit recursive edit with"
1751 " \\[exit-recursive-edit]")))
1752 (save-window-excursion (save-excursion
1753 (recursive-edit))))
1754 ;; protected
1755 (goto-char ispell-recursive-edit-marker)
1756 (if (not (equal (marker-buffer
1757 ispell-recursive-edit-marker)
1758 (current-buffer)))
1759 (progn
1760 (set-marker ispell-recursive-edit-marker nil)
1761 (error
1762 "Cannot continue ispell from this buffer.")))
1763 (set-marker ispell-recursive-edit-marker nil)))
1764 (list word nil)) ; recheck starting at this word.
1765 ((= char ?\C-z)
1766 (funcall (key-binding "\C-z"))
1768 (t (ding) t))))))
1769 result)
1770 ;; protected
1771 (and ispell-highlight-p ; unhighlight
1772 (save-window-excursion
1773 (select-window textwin)
1774 (ispell-highlight-spelling-error start end)))
1775 (if dedicated
1776 (set-window-dedicated-p dedicated-win t)))))
1780 (defun ispell-show-choices (line end)
1781 "Shows the choices in another buffer or frame."
1782 (if (and ispell-use-framepop-p (fboundp 'framepop-display-buffer))
1783 (progn
1784 (framepop-display-buffer (get-buffer ispell-choices-buffer))
1785 (get-buffer-window ispell-choices-buffer t)
1786 (select-window (previous-window))) ; *Choices* window
1787 ;; standard selection by splitting a small buffer out of this window.
1788 (let ((choices-window (get-buffer-window ispell-choices-buffer)))
1789 (if choices-window
1790 (if (= line (ispell-adjusted-window-height choices-window))
1791 (select-window choices-window)
1792 ;; *Choices* window changed size. Adjust the choices window
1793 ;; without scrolling the spelled window when possible
1794 (let ((window-line
1795 (- line (ispell-adjusted-window-height choices-window)))
1796 (visible (progn (vertical-motion -1) (point))))
1797 (if (< line ispell-choices-win-default-height)
1798 (setq window-line (+ window-line
1799 (- ispell-choices-win-default-height
1800 line))))
1801 (move-to-window-line 0)
1802 (vertical-motion window-line)
1803 (set-window-start (selected-window)
1804 (if (> (point) visible) visible (point)))
1805 (goto-char end)
1806 (select-window (previous-window)) ; *Choices* window
1807 (enlarge-window window-line)))
1808 ;; Overlay *Choices* window when it isn't showing
1809 (ispell-overlay-window (max line ispell-choices-win-default-height)))
1810 (switch-to-buffer ispell-choices-buffer)
1811 (goto-char (point-min)))))
1814 ;;;###autoload
1815 (defun ispell-help ()
1816 "Display a list of the options available when a misspelling is encountered.
1818 Selections are:
1820 DIGIT: Replace the word with a digit offered in the *Choices* buffer.
1821 SPC: Accept word this time.
1822 `i': Accept word and insert into private dictionary.
1823 `a': Accept word for this session.
1824 `A': Accept word and place in `buffer-local dictionary'.
1825 `r': Replace word with typed-in value. Rechecked.
1826 `R': Replace word with typed-in value. Query-replaced in buffer. Rechecked.
1827 `?': Show these commands.
1828 `x': Exit spelling buffer. Move cursor to original point.
1829 `X': Exit spelling buffer. Leaves cursor at the current point, and permits
1830 the aborted check to be completed later.
1831 `q': Quit spelling session (Kills ispell process).
1832 `l': Look up typed-in replacement in alternate dictionary. Wildcards okay.
1833 `u': Like `i', but the word is lower-cased first.
1834 `m': Place typed-in value in personal dictionary, then recheck current word.
1835 `C-l': redraws screen
1836 `C-r': recursive edit
1837 `C-z': suspend emacs or iconify frame"
1839 (if (equal ispell-help-in-bufferp 'electric)
1840 (progn
1841 (require 'ehelp)
1842 (with-electric-help
1843 (function (lambda ()
1844 ;;This shouldn't be necessary: with-electric-help needs
1845 ;; an optional argument telling it about the smallest
1846 ;; acceptable window-height of the help buffer.
1847 (if (< (window-height) 15)
1848 (enlarge-window
1849 (- 15 (ispell-adjusted-window-height))))
1850 (princ "Selections are:
1852 DIGIT: Replace the word with a digit offered in the *Choices* buffer.
1853 SPC: Accept word this time.
1854 `i': Accept word and insert into private dictionary.
1855 `a': Accept word for this session.
1856 `A': Accept word and place in `buffer-local dictionary'.
1857 `r': Replace word with typed-in value. Rechecked.
1858 `R': Replace word with typed-in value. Query-replaced in buffer. Rechecked.
1859 `?': Show these commands.
1860 `x': Exit spelling buffer. Move cursor to original point.
1861 `X': Exit spelling buffer. Leaves cursor at the current point, and permits
1862 the aborted check to be completed later.
1863 `q': Quit spelling session (Kills ispell process).
1864 `l': Look up typed-in replacement in alternate dictionary. Wildcards okay.
1865 `u': Like `i', but the word is lower-cased first.
1866 `m': Place typed-in value in personal dictionary, then recheck current word.
1867 `C-l': redraws screen
1868 `C-r': recursive edit
1869 `C-z': suspend emacs or iconify frame")
1870 nil ;undocumented requirement of with-electric-help
1871 ))))
1874 (let ((help-1 (concat "[r/R]eplace word; [a/A]ccept for this session; "
1875 "[i]nsert into private dictionary"))
1876 (help-2 (concat "[l]ook a word up in alternate dictionary; "
1877 "e[x/X]it; [q]uit session"))
1878 (help-3 (concat "[u]ncapitalized insert into dict. "
1879 "Type 'x C-h d ispell-help' for more help")))
1880 (save-window-excursion
1881 (if ispell-help-in-bufferp
1882 (progn
1883 (ispell-overlay-window 4)
1884 (switch-to-buffer (get-buffer-create "*Ispell Help*"))
1885 (insert (concat help-1 "\n" help-2 "\n" help-3))
1886 (sit-for 5)
1887 (kill-buffer "*Ispell Help*"))
1888 (unwind-protect
1889 (progn
1890 (select-window (minibuffer-window))
1891 (erase-buffer)
1892 (message nil)
1893 ;;(set-minibuffer-window (selected-window))
1894 (enlarge-window 2)
1895 (insert (concat help-1 "\n" help-2 "\n" help-3))
1896 (sit-for 5))
1897 (erase-buffer)))))))
1900 (defun lookup-words (word &optional lookup-dict)
1901 "Look up WORD in optional word-list dictionary LOOKUP-DICT.
1902 A `*' serves as a wild card. If no wild cards, `look' is used if it exists.
1903 Otherwise the variable `ispell-grep-command' contains the command used to
1904 search for the words (usually egrep).
1906 Optional second argument contains the dictionary to use; the default is
1907 `ispell-alternate-dictionary'."
1908 ;; We don't use the filter for this function, rather the result is written
1909 ;; into a buffer. Hence there is no need to save the filter values.
1910 (if (null lookup-dict)
1911 (setq lookup-dict ispell-alternate-dictionary))
1913 (let* ((process-connection-type ispell-use-ptys-p)
1914 (wild-p (string-match "\\*" word))
1915 (look-p (and ispell-look-p ; Only use look for an exact match.
1916 (or ispell-have-new-look (not wild-p))))
1917 (ispell-grep-buffer (get-buffer-create "*Ispell-Temp*")) ; result buf
1918 (prog (if look-p ispell-look-command ispell-grep-command))
1919 (args (if look-p ispell-look-options ispell-grep-options))
1920 status results loc)
1921 (unwind-protect
1922 (save-window-excursion
1923 (message "Starting \"%s\" process..." (file-name-nondirectory prog))
1924 (set-buffer ispell-grep-buffer)
1925 (if look-p
1927 ;; convert * to .*
1928 (insert "^" word "$")
1929 (while (search-backward "*" nil t) (insert "."))
1930 (setq word (buffer-string))
1931 (erase-buffer))
1932 (setq status (if lookup-dict
1933 (call-process prog nil t nil args word lookup-dict)
1934 (call-process prog nil t nil args word)))
1935 ;; grep returns status 1 and no output when word not found, which
1936 ;; is a perfectly normal thing.
1937 (if (stringp status)
1938 (setq results (cons (format "error: %s exited with signal %s"
1939 (file-name-nondirectory prog) status)
1940 results))
1941 ;; else collect words into `results' in FIFO order
1942 (goto-char (point-max))
1943 ;; assure we've ended with \n
1944 (or (bobp) (= (preceding-char) ?\n) (insert ?\n))
1945 (while (not (bobp))
1946 (setq loc (point))
1947 (forward-line -1)
1948 (setq results (cons (buffer-substring-no-properties (point)
1949 (1- loc))
1950 results)))))
1951 ;; protected
1952 (kill-buffer ispell-grep-buffer)
1953 (if (and results (string-match ".+: " (car results)))
1954 (error "%s error: %s" ispell-grep-command (car results))))
1955 results))
1958 ;;; "ispell-filter" is a list of output lines from the generating function.
1959 ;;; Each full line (ending with \n) is a separate item on the list.
1960 ;;; "output" can contain multiple lines, part of a line, or both.
1961 ;;; "start" and "end" are used to keep bounds on lines when "output" contains
1962 ;;; multiple lines.
1963 ;;; "ispell-filter-continue" is true when we have received only part of a
1964 ;;; line as output from a generating function ("output" did not end with \n)
1965 ;;; THIS FUNCTION WILL FAIL IF THE PROCESS OUTPUT DOESN'T END WITH \n!
1966 ;;; This is the case when a process dies or fails. The default behavior
1967 ;;; in this case treats the next input received as fresh input.
1969 (defun ispell-filter (process output)
1970 "Output filter function for ispell, grep, and look."
1971 (let ((start 0)
1972 (continue t)
1973 end)
1974 (while continue
1975 (setq end (string-match "\n" output start)) ; get text up to the newline.
1976 ;; If we get out of sync and ispell-filter-continue is asserted when we
1977 ;; are not continuing, treat the next item as a separate list. When
1978 ;; ispell-filter-continue is asserted, ispell-filter *should* always be a
1979 ;; list!
1981 ;; Continue with same line (item)?
1982 (if (and ispell-filter-continue ispell-filter (listp ispell-filter))
1983 ;; Yes. Add it to the prev item
1984 (setcar ispell-filter
1985 (concat (car ispell-filter) (substring output start end)))
1986 ;; No. This is a new line and item.
1987 (setq ispell-filter
1988 (cons (substring output start end) ispell-filter)))
1989 (if (null end)
1990 ;; We've completed reading the output, but didn't finish the line.
1991 (setq ispell-filter-continue t continue nil)
1992 ;; skip over newline, this line complete.
1993 (setq ispell-filter-continue nil end (1+ end))
1994 (if (= end (length output)) ; No more lines in output
1995 (setq continue nil) ; so we can exit the filter.
1996 (setq start end)))))) ; else move start to next line of input
1999 ;;; This function destroys the mark location if it is in the word being
2000 ;;; highlighted.
2001 (defun ispell-highlight-spelling-error-generic (start end &optional highlight
2002 refresh)
2003 "Highlight the word from START to END with a kludge using `inverse-video'.
2004 When the optional third arg HIGHLIGHT is set, the word is highlighted;
2005 otherwise it is displayed normally.
2006 Uses block cursor to highlight one character.
2007 Optional REFRESH will unhighlighted then highlight, using block cursor
2008 highlighting when REFRESH is equal to `block'."
2009 (and (eq 'block ispell-highlight-p)
2010 (or (eq 'block refresh)
2011 (setq start (1+ start)))) ; On block non-refresh, inc start.
2012 (let ((modified (buffer-modified-p)) ; don't allow this fn to modify buffer
2013 (buffer-read-only nil) ; Allow highlighting read-only buffers.
2014 (text (buffer-substring-no-properties start end)) ; Save hilight region
2015 (inhibit-quit t) ; inhibit interrupt processing here.
2016 (buffer-undo-list t)) ; don't clutter the undo list.
2017 (goto-char end)
2018 (delete-region start end)
2019 (insert-char ? (- end start)) ; minimize amount of redisplay
2020 (sit-for 0) ; update display
2021 (if highlight (setq inverse-video (not inverse-video))) ; toggle video
2022 (delete-region start end) ; delete whitespace
2023 (insert text) ; insert text in inverse video.
2024 (sit-for 0) ; update display showing inverse video.
2025 (if (not highlight)
2026 (goto-char end)
2027 (setq inverse-video (not inverse-video)) ; toggle video
2028 (and (eq 'block ispell-highlight-p)
2029 (goto-char (1- start)))) ; use block cursor to "highlight" char
2030 (set-buffer-modified-p modified) ; don't modify if flag not set.
2031 (and refresh ; re-highlight
2032 (ispell-highlight-spelling-error-generic
2033 (if (eq 'block refresh) start (- start 2)) end t))))
2036 (defun ispell-highlight-spelling-error-xemacs (start end &optional highlight)
2037 "Highlight the word from START to END using `isearch-highlight'.
2038 When the optional third arg HIGHLIGHT is set, the word is highlighted,
2039 otherwise it is displayed normally."
2040 (if highlight
2041 (isearch-highlight start end)
2042 (isearch-dehighlight t))
2043 ;;(sit-for 0)
2047 (defun ispell-highlight-spelling-error-overlay (start end &optional highlight)
2048 "Highlight the word from START to END using overlays.
2049 When the optional third arg HIGHLIGHT is set, the word is highlighted
2050 otherwise it is displayed normally.
2052 The variable `ispell-highlight-face' selects the face to use for highlighting."
2053 (if highlight
2054 (progn
2055 (setq ispell-overlay (make-overlay start end))
2056 (overlay-put ispell-overlay 'face ispell-highlight-face))
2057 (delete-overlay ispell-overlay)))
2060 (defun ispell-highlight-spelling-error (start end &optional highlight refresh)
2061 (cond
2062 (xemacsp
2063 (ispell-highlight-spelling-error-xemacs start end highlight))
2064 ((and (featurep 'faces)
2065 (or (and (fboundp 'display-color-p) (display-color-p))
2066 window-system))
2067 (ispell-highlight-spelling-error-overlay start end highlight))
2068 (t (ispell-highlight-spelling-error-generic start end highlight refresh))))
2070 (defun ispell-adjusted-window-height (&optional window)
2071 "Like `window-height', adjusted to correct for the effect of tall mode-lines.
2072 The value returned is actually the nominal number of text-lines in the
2073 window plus 1. On a terminal, this is the same value returned by
2074 `window-height', but if the window has a mode-line is taller than a normal
2075 text line, the returned value may be smaller than that from
2076 `window-height'."
2077 (cond ((fboundp 'window-text-height)
2078 (1+ (window-text-height window)))
2079 (ispell-graphic-p
2080 (1- (window-height window)))
2082 (window-height window))))
2084 (defun ispell-overlay-window (height)
2085 "Create a window covering the top HEIGHT lines of the current window.
2086 Ensure that the line above point is still visible but otherwise avoid
2087 scrolling the current window. Leave the new window selected."
2088 (save-excursion
2089 (let ((oldot (save-excursion (vertical-motion -1) (point)))
2090 (top (save-excursion (move-to-window-line height) (point))))
2091 ;; If line above old point (line starting at oldot) would be
2092 ;; hidden by new window, scroll it to just below new win
2093 ;; otherwise set top line of other win so it doesn't scroll.
2094 (if (< oldot top) (setq top oldot))
2095 ;; if frame is unsplitable, temporarily disable that...
2096 (if (cdr (assq 'unsplittable (frame-parameters (selected-frame))))
2097 (let ((frame (selected-frame)))
2098 (modify-frame-parameters frame '((unsplittable . nil)))
2099 (split-window nil height)
2100 (modify-frame-parameters frame '((unsplittable . t))))
2101 (split-window nil height))
2102 (let ((deficit (- height (ispell-adjusted-window-height))))
2103 (when (> deficit 0)
2104 ;; Number of lines the window is still too short. We ensure that
2105 ;; there are at least (1- HEIGHT) lines visible in the window.
2106 (enlarge-window deficit)
2107 (goto-char top)
2108 (vertical-motion deficit)
2109 (setq top (min (point) oldot))))
2110 (set-window-start (next-window) top))))
2113 ;;; Should we add a compound word match return value?
2114 (defun ispell-parse-output (output &optional accept-list shift)
2115 "Parse the OUTPUT string from Ispell process and return:
2116 1: t for an exact match.
2117 2: A string containing the root word matched via suffix removal.
2118 3: A list of possible correct spellings of the format:
2119 (\"ORIGINAL-WORD\" OFFSET MISS-LIST GUESS-LIST)
2120 ORIGINAL-WORD is a string of the possibly misspelled word.
2121 OFFSET is an integer giving the line offset of the word.
2122 MISS-LIST and GUESS-LIST are possibly null lists of guesses and misses.
2123 4: nil when an error has occurred.
2125 Optional second arg ACCEPT-LIST is list of words already accepted.
2126 Optional third arg SHIFT is an offset to apply based on previous corrections."
2127 (cond
2128 ((string= output "") t) ; for startup with pipes...
2129 ((string= output "*") t) ; exact match
2130 ((string= output "-") t) ; compound word match
2131 ((string= (substring output 0 1) "+") ; found because of root word
2132 (substring output 2)) ; return root word
2133 ((equal 0 (string-match "[\ra-zA-Z]" output))
2134 (ding) ; error message from ispell!
2135 (message (concat "Ispell error: " output))
2136 (sit-for 5)
2137 nil)
2138 (t ; need to process &, ?, and #'s
2139 (let ((type (substring output 0 1)) ; &, ?, or #
2140 (original-word (substring output 2 (string-match " " output 2)))
2141 (cur-count 0) ; contains number of misses + guesses
2142 count miss-list guess-list offset)
2143 (setq output (substring output (match-end 0))) ; skip over misspelling
2144 (if (string= type "#")
2145 (setq count 0) ; no misses for type #
2146 (setq count (string-to-int output) ; get number of misses.
2147 output (substring output (1+ (string-match " " output 1)))))
2148 (setq offset (string-to-int output))
2149 (if (string= type "#") ; No miss or guess list.
2150 (setq output nil)
2151 (setq output (substring output (1+ (string-match " " output 1)))))
2152 (while output
2153 (let ((end (string-match ", \\|\\($\\)" output))) ; end of miss/guess.
2154 (setq cur-count (1+ cur-count))
2155 (if (> cur-count count)
2156 (setq guess-list (cons (substring output 0 end) guess-list))
2157 (setq miss-list (cons (substring output 0 end) miss-list)))
2158 (if (match-end 1) ; True only when at end of line.
2159 (setq output nil) ; no more misses or guesses
2160 (setq output (substring output (+ end 2))))))
2161 ;; return results. Accept word if it was already accepted.
2162 ;; adjust offset.
2163 (if (member original-word accept-list)
2165 (list original-word
2166 (if (numberp shift) (+ shift offset) offset)
2167 (nreverse miss-list) (nreverse guess-list)))))))
2170 (defun ispell-process-status ()
2171 "Return the status of the Ispell process.
2172 When asynchronous processes are not supported, `run' is always returned."
2173 (if ispell-async-processp
2174 (process-status ispell-process)
2175 (and ispell-process 'run)))
2178 (defun ispell-start-process ()
2179 "Start the ispell process, with support for no asynchronous processes.
2180 Keeps argument list for future ispell invocations for no async support."
2181 (let (args)
2182 ;; Local dictionary becomes the global dictionary in use.
2183 (if ispell-local-dictionary
2184 (setq ispell-dictionary ispell-local-dictionary))
2185 (setq args (ispell-get-ispell-args))
2186 (if ispell-dictionary ; use specified dictionary
2187 (setq args
2188 (append (list "-d" ispell-dictionary) args)))
2189 (if ispell-personal-dictionary ; use specified pers dict
2190 (setq args
2191 (append args
2192 (list "-p"
2193 (expand-file-name ispell-personal-dictionary)))))
2194 (setq args (append args ispell-extra-args))
2196 (if ispell-async-processp
2197 (let ((process-connection-type ispell-use-ptys-p))
2198 (apply 'start-process
2199 "ispell" nil ispell-program-name
2200 "-a" ; accept single input lines
2201 "-m" ; make root/affix combos not in dict
2202 args))
2203 (setq ispell-cmd-args args
2204 ispell-output-buffer (generate-new-buffer " *ispell-output*")
2205 ispell-session-buffer (generate-new-buffer " *ispell-session*"))
2206 (ispell-send-string "\032\n") ; so Ispell prints version and exits
2207 t)))
2211 (defun ispell-init-process ()
2212 "Check status of Ispell process and start if necessary."
2213 (if (and ispell-process
2214 (eq (ispell-process-status) 'run)
2215 ;; If we're using a personal dictionary, ensure
2216 ;; we're in the same default directory!
2217 (or (not ispell-personal-dictionary)
2218 (equal ispell-process-directory default-directory)))
2219 (setq ispell-filter nil ispell-filter-continue nil)
2220 ;; may need to restart to select new personal dictionary.
2221 (ispell-kill-ispell t)
2222 (message "Starting new Ispell process...")
2223 (sit-for 0)
2224 (check-ispell-version)
2225 (setq ispell-process-directory default-directory
2226 ispell-process (ispell-start-process)
2227 ispell-filter nil
2228 ispell-filter-continue nil)
2229 (if ispell-async-processp
2230 (set-process-filter ispell-process 'ispell-filter))
2231 ;; protect against bogus binding of `enable-multibyte-characters' in XEmacs
2232 (if (and (or xemacsp
2233 (and (boundp 'enable-multibyte-characters)
2234 enable-multibyte-characters))
2235 (fboundp 'set-process-coding-system))
2236 (set-process-coding-system ispell-process (ispell-get-coding-system)
2237 (ispell-get-coding-system)))
2238 ;; Get version ID line
2239 (ispell-accept-output 3)
2240 ;; get more output if filter empty?
2241 (if (null ispell-filter) (ispell-accept-output 3))
2242 (cond ((null ispell-filter)
2243 (error "%s did not output version line" ispell-program-name))
2244 ((and
2245 (stringp (car ispell-filter))
2246 (if (string-match "warning: " (car ispell-filter))
2247 (progn
2248 (ispell-accept-output 3) ; was warn msg.
2249 (stringp (car ispell-filter)))
2250 (null (cdr ispell-filter)))
2251 (string-match "^@(#) " (car ispell-filter)))
2252 ;; got the version line as expected (we already know it's the right
2253 ;; version, so don't bother checking again.)
2254 nil)
2256 ;; Otherwise, it must be an error message. Show the user.
2257 ;; But first wait to see if some more output is going to arrive.
2258 ;; Otherwise we get cool errors like "Can't open ".
2259 (sleep-for 1)
2260 (ispell-accept-output 3)
2261 (error "%s" (mapconcat 'identity ispell-filter "\n"))))
2262 (setq ispell-filter nil) ; Discard version ID line
2263 (let ((extended-char-mode (ispell-get-extended-character-mode)))
2264 (if extended-char-mode ; ~ extended character mode
2265 (ispell-send-string (concat extended-char-mode "\n"))))
2266 (if ispell-async-processp
2267 (process-kill-without-query ispell-process))))
2269 ;;;###autoload
2270 (defun ispell-kill-ispell (&optional no-error)
2271 "Kill current Ispell process (so that you may start a fresh one).
2272 With NO-ERROR, just return non-nil if there was no Ispell running."
2273 (interactive)
2274 (if (not (and ispell-process
2275 (eq (ispell-process-status) 'run)))
2276 (or no-error
2277 (error "There is no ispell process running!"))
2278 (if ispell-async-processp
2279 (progn
2280 (process-send-eof ispell-process)
2281 (if (eq (ispell-process-status) 'run)
2282 (ispell-accept-output 1))
2283 (if (eq (ispell-process-status) 'run)
2284 (kill-process ispell-process))
2285 (while (not (or (eq (ispell-process-status) 'exit)
2286 (eq (ispell-process-status) 'signal)))
2287 (sleep-for 0.25)))
2288 ;; synchronous processes
2289 (ispell-send-string "\n") ; make sure side effects occurred.
2290 (kill-buffer ispell-output-buffer)
2291 (kill-buffer ispell-session-buffer)
2292 (setq ispell-output-buffer nil
2293 ispell-session-buffer nil))
2294 (setq ispell-process nil)
2295 (message "Ispell process killed")
2296 nil))
2299 ;;; ispell-change-dictionary is set in some people's hooks. Maybe this should
2300 ;;; call ispell-init-process rather than wait for a spell checking command?
2302 ;;;###autoload
2303 (defun ispell-change-dictionary (dict &optional arg)
2304 "Change `ispell-dictionary' (q.v.) to DICT and kill old Ispell process.
2305 A new one will be started as soon as necessary.
2307 By just answering RET you can find out what the current dictionary is.
2309 With prefix argument, set the default dictionary."
2310 (interactive
2311 (list (completing-read
2312 "Use new dictionary (RET for current, SPC to complete): "
2313 (cons (cons "default" nil) ispell-dictionary-alist) nil t)
2314 current-prefix-arg))
2315 (if (equal dict "default") (setq dict nil))
2316 ;; This relies on completing-read's bug of returning "" for no match
2317 (cond ((equal dict "")
2318 (message "Using %s dictionary"
2319 (or ispell-local-dictionary ispell-dictionary "default")))
2320 ((and (equal dict ispell-dictionary)
2321 (or (null ispell-local-dictionary)
2322 (equal dict ispell-local-dictionary)))
2323 ;; Specified dictionary is the default already. No-op
2324 (and (interactive-p)
2325 (message "No change, using %s dictionary" (or dict "default"))))
2326 (t ; reset dictionary!
2327 (if (assoc dict ispell-dictionary-alist)
2328 (progn
2329 (if (or arg (null dict)) ; set default dictionary
2330 (setq ispell-dictionary dict))
2331 (if (null arg) ; set local dictionary
2332 (setq ispell-local-dictionary dict)))
2333 (error "Undefined dictionary: %s" dict))
2334 (ispell-kill-ispell t)
2335 (message "(Next %sIspell command will use %s dictionary)"
2336 (cond ((equal ispell-local-dictionary ispell-dictionary)
2338 (arg "global ")
2339 (t "local "))
2340 (or (if (or (equal ispell-local-dictionary ispell-dictionary)
2341 (null arg))
2342 ispell-local-dictionary
2343 ispell-dictionary)
2344 "default")))))
2347 ;;; Spelling of comments are checked when ispell-check-comments is non-nil.
2349 ;;;###autoload
2350 (defun ispell-region (reg-start reg-end &optional recheckp shift)
2351 "Interactively check a region for spelling errors.
2352 Return nil if spell session is quit,
2353 otherwise returns shift offset amount for last line processed."
2354 (interactive "r") ; Don't flag errors on read-only bufs.
2355 (if (not recheckp)
2356 (ispell-accept-buffer-local-defs)) ; set up dictionary, local words, etc.
2357 (unwind-protect
2358 (save-excursion
2359 (message "Spell checking %s using %s dictionary..."
2360 (if (and (= reg-start (point-min)) (= reg-end (point-max)))
2361 (buffer-name) "region")
2362 (or ispell-dictionary "default"))
2363 ;; Returns cursor to original location.
2364 (save-window-excursion
2365 (goto-char reg-start)
2366 (let ((transient-mark-mode)
2367 (case-fold-search case-fold-search)
2368 (skip-region-start (make-marker))
2369 (skip-regexp (ispell-begin-skip-region-regexp))
2370 (skip-alist ispell-skip-region-alist)
2371 key)
2372 (if (eq ispell-parser 'tex)
2373 (setq case-fold-search nil
2374 skip-alist
2375 (append (car ispell-tex-skip-alists)
2376 (car (cdr ispell-tex-skip-alists))
2377 skip-alist)))
2378 (let (message-log-max)
2379 (message "searching for regions to skip"))
2380 (if (re-search-forward skip-regexp reg-end t)
2381 (progn
2382 (setq key (buffer-substring-no-properties
2383 (match-beginning 0) (match-end 0)))
2384 (set-marker skip-region-start (- (point) (length key)))
2385 (goto-char reg-start)))
2386 (let (message-log-max)
2387 (message "Continuing spelling check using %s dictionary..."
2388 (or ispell-dictionary "default")))
2389 (set-marker ispell-region-end reg-end)
2390 (while (and (not ispell-quit)
2391 (< (point) ispell-region-end))
2392 ;; spell-check region with skipping
2393 (if (and (marker-position skip-region-start)
2394 (<= skip-region-start (point)))
2395 (progn
2396 (ispell-skip-region key skip-alist) ; moves pt past region.
2397 (setq reg-start (point))
2398 (if (and (< reg-start ispell-region-end)
2399 (re-search-forward skip-regexp
2400 ispell-region-end t))
2401 (progn
2402 (setq key (buffer-substring-no-properties
2403 (car (match-data))
2404 (car (cdr (match-data)))))
2405 (set-marker skip-region-start
2406 (- (point) (length key)))
2407 (goto-char reg-start))
2408 (set-marker skip-region-start nil))))
2409 (setq reg-end (if (marker-position skip-region-start)
2410 (min skip-region-start ispell-region-end)
2411 (marker-position ispell-region-end)))
2412 (let* ((start (point))
2413 (end (save-excursion (end-of-line) (min (point) reg-end)))
2414 (string (ispell-get-line start end reg-end)))
2415 (setq end (point)) ; "end" tracks region retrieved.
2416 (if string ; there is something to spell check!
2417 ;; (special start end)
2418 (setq shift (ispell-process-line string
2419 (and recheckp shift))))
2420 (goto-char end)))))
2421 (if ispell-quit
2423 (or shift 0)))
2424 ;; protected
2425 (if (and (not (and recheckp ispell-keep-choices-win))
2426 (get-buffer ispell-choices-buffer))
2427 (kill-buffer ispell-choices-buffer))
2428 (if ispell-quit
2429 (progn
2430 ;; preserve or clear the region for ispell-continue.
2431 (if (not (numberp ispell-quit))
2432 (set-marker ispell-region-end nil)
2433 ;; Ispell-continue enabled - ispell-region-end is set.
2434 (goto-char ispell-quit))
2435 ;; Check for aborting
2436 (if (and ispell-checking-message (numberp ispell-quit))
2437 (progn
2438 (setq ispell-quit nil)
2439 (error "Message send aborted")))
2440 (if (not recheckp) (setq ispell-quit nil)))
2441 (if (not recheckp) (set-marker ispell-region-end nil))
2442 ;; Only save if successful exit.
2443 (ispell-pdict-save ispell-silently-savep)
2444 (message "Spell-checking done"))))
2447 ;;; Creates the regexp for skipping a region.
2448 ;;; Makes the skip-regexp local for tex buffers adding in the
2449 ;;; tex expressions to skip as well.
2450 ;;; Call AFTER ispell-buffer-local-parsing.
2451 (defun ispell-begin-skip-region-regexp ()
2452 (let ((skip-regexp (ispell-begin-skip-region)))
2453 (if (and (null ispell-check-comments) comment-start)
2454 (setq skip-regexp (concat (regexp-quote comment-start) "\\|"
2455 skip-regexp)))
2456 (if (and (eq 'exclusive ispell-check-comments) comment-start)
2457 (setq skip-regexp (concat (if (string= "" comment-end) "^"
2458 (regexp-quote comment-end))
2459 "\\|" skip-regexp)))
2460 (if ispell-skip-tib
2461 (setq skip-regexp (concat ispell-tib-ref-beginning "\\|" skip-regexp)))
2462 (if ispell-skip-html
2463 (setq skip-regexp (concat "<[cC][oO][dD][eE]\\>[^>]*>" "\\|"
2464 "<[sS][cC][rR][iI][pP][tT]\\>[^>]*>" "\\|"
2465 "<[aA][pP][pP][lL][eE][tT]\\>[^>]*>" "\\|"
2466 "<[vV][eE][rR][bB]\\>[^>]*>" "\\|"
2467 ;; "<[tT][tT]\\>[^>]*>" "\\|"
2468 "<[tT][tT]/" "\\|"
2469 "<" "\\|"
2470 "&" "\\|"
2471 skip-regexp)))
2472 (if (eq ispell-parser 'tex)
2473 (setq skip-regexp (concat (ispell-begin-tex-skip-regexp) "\\|"
2474 skip-regexp)))
2475 skip-regexp))
2478 (defun ispell-begin-tex-skip-regexp ()
2479 "Regular expression of tex commands to skip.
2480 Generated from `ispell-tex-skip-alists'."
2481 (concat
2482 (mapconcat (function (lambda (lst) (car lst)))
2483 (car ispell-tex-skip-alists)
2484 "\\|")
2485 "\\|"
2486 (mapconcat (function (lambda (lst)
2487 (concat "\\\\begin[ \t\n]*{[ \t\n]*"
2488 (car lst)
2489 "[ \t\n]*}")))
2490 (car (cdr ispell-tex-skip-alists))
2491 "\\|")))
2494 (defun ispell-begin-skip-region ()
2495 "Regular expression of regions to skip for all buffers.
2496 Each selection should be a key of `ispell-skip-region-alist';
2497 otherwise, the current line is skipped."
2498 (mapconcat (function (lambda (lst) (if (stringp (car lst)) (car lst)
2499 (eval (car lst)))))
2500 ispell-skip-region-alist
2501 "\\|"))
2504 (defun ispell-tex-arg-end (&optional arg)
2505 (condition-case nil
2506 (progn
2507 (while (looking-at "[ \t\n]*\\[") (forward-sexp))
2508 (forward-sexp (or arg 1)))
2509 (error
2510 (message "error skipping s-expressions at point %d." (point))
2511 (beep)
2512 (sit-for 2))))
2515 ;;; Skips to region-end from point, or a single line.
2516 ;;; Places point at end of region skipped.
2517 (defun ispell-skip-region (key alist)
2518 ;; move over key to begin checking.
2519 (forward-char (length key))
2520 (let ((start (point))
2521 alist-key null-skip)
2522 (cond
2523 ;; what about quoted comment, or comment inside strings?
2524 ((and (null ispell-check-comments) comment-start
2525 (string= key comment-start))
2526 (if (string= "" comment-end)
2527 (forward-line)
2528 (search-forward comment-end ispell-region-end t)))
2529 ((and (eq 'exclusive ispell-check-comments) comment-start
2530 (string= key comment-end))
2531 (search-forward comment-start ispell-region-end :end))
2532 ((and ispell-skip-tib (string-match ispell-tib-ref-beginning key))
2533 (re-search-forward ispell-tib-ref-end ispell-region-end t))
2534 ((and ispell-skip-html (string-match "</" key))
2535 (search-forward ">" ispell-region-end t))
2536 ((and ispell-skip-html (string-match "<[cC][oO][dD][eE]\\>[^>]*>" key))
2537 (search-forward-regexp "</[cC][oO][dD][eE]>" ispell-region-end t))
2538 ((and ispell-skip-html
2539 (string-match "<[sS][cC][rR][iI][pP][tT]\\>[^>]*>" key))
2540 (search-forward-regexp "</[sS][cC][rR][iI][pP][tT]>" ispell-region-end t))
2541 ((and ispell-skip-html
2542 (string-match "<[aA][pP][pP][lL][eE][tT]\\>[^>]*>" key))
2543 (search-forward-regexp "</[aA][pP][pP][lL][eE][tT]>" ispell-region-end t))
2544 ((and ispell-skip-html (string-match "<[vV][eE][rR][bB]\\>[^>]*>" key))
2545 (search-forward-regexp "</[vV][eE][rR][bB]>" ispell-region-end t))
2546 ;;((and ispell-skip-html (string-match "<[tT][tT]\\>[^>]*>" key))
2547 ;; (search-forward-regexp "</[tT][tT]>" ispell-region-end t))
2548 ((and ispell-skip-html (string-match "<[tT][tT]/" key))
2549 (search-forward "/" ispell-region-end t))
2550 ((and ispell-skip-html (string-match "<" key))
2551 (search-forward ">" ispell-region-end t))
2552 ((and ispell-skip-html (string-match "&" key))
2553 (search-forward-regexp "[; \t\n]" ispell-region-end t))
2554 ;; markings from alist
2556 (while alist
2557 (setq alist-key (eval (car (car alist))))
2558 (if (string-match alist-key key)
2559 (progn
2560 (setq alist (cdr (car alist)))
2561 (cond
2562 ((null alist) (setq null-skip t)) ; done! Just skip key.
2563 ((not (consp alist))
2564 ;; Search past end of spell region to find this region end.
2565 (re-search-forward (eval alist) (point-max) t))
2566 ((consp alist)
2567 (if (stringp alist)
2568 (re-search-forward alist (point-max) t)
2569 (setq null-skip t) ; error handling in functions!
2570 (if (consp (cdr alist))
2571 (apply (car alist) (cdr alist))
2572 (funcall (car alist))))))
2573 (setq alist nil))
2574 (setq alist (cdr alist))))))
2575 (if (and (= start (point)) (null null-skip))
2576 (progn
2577 (message "Matching region end for `%s' point %d not found"
2578 key (point))
2579 (beep)
2580 (sit-for 2)))))
2583 ;;; Grab the next line of data.
2584 ;;; Returns a string with the line data
2585 (defun ispell-get-line (start end reg-end)
2586 (let ((ispell-casechars (ispell-get-casechars))
2587 string)
2588 (cond ; LOOK AT THIS LINE AND SKIP OR PROCESS
2589 ((eolp) ; END OF LINE, just go to next line.
2590 (forward-line))
2591 ;;((looking-at "[-#@*+!%~^]") ; SKIP SPECIAL ISPELL CHARACTERS
2592 ;; (forward-char 1)) ; not needed as quoted below.
2593 ((or (re-search-forward ispell-casechars end t) ; TEXT EXISTS
2594 (re-search-forward "[][()${}]" end t)) ; or MATH COMMANDS
2595 (setq string (concat "^" (buffer-substring-no-properties start end)
2596 "\n"))
2597 (goto-char end))
2598 (t (goto-char end))) ; EMPTY LINE, skip it.
2599 string))
2602 ;;; Avoid error messages when compiling for these dynamic variables.
2603 (eval-when-compile
2604 (defvar start)
2605 (defvar end))
2607 (defun ispell-process-line (string shift)
2608 "Sends a LINE of text to ispell and processes the result.
2609 This will modify the buffer for spelling errors.
2610 Requires variables START and END to be defined in its lexical scope.
2611 Returns the sum shift due to changes in word replacements."
2612 ;;(declare special start end)
2613 (let (poss accept-list)
2614 (if (not (numberp shift))
2615 (setq shift 0))
2616 ;; send string to spell process and get input.
2617 (ispell-send-string string)
2618 (while (progn
2619 (ispell-accept-output)
2620 ;; Last item of output contains a blank line.
2621 (not (string= "" (car ispell-filter)))))
2622 ;; parse all inputs from the stream one word at a time.
2623 ;; Place in FIFO order and remove the blank item.
2624 (setq ispell-filter (nreverse (cdr ispell-filter)))
2625 (while (and (not ispell-quit) ispell-filter)
2626 ;; get next word, accounting for accepted words and start shifts
2627 (setq poss (ispell-parse-output (car ispell-filter)
2628 accept-list shift))
2629 (if (and poss (listp poss)) ; spelling error occurred.
2630 ;; Whenever we have misspellings, we can change
2631 ;; the buffer. Keep boundaries as markers.
2632 ;; Markers can move with highlighting! This destroys
2633 ;; end of region markers line-end and ispell-region-end
2634 (let ((word-start
2635 (copy-marker (+ start ispell-offset (car (cdr poss)))))
2636 (word-len (length (car poss)))
2637 (line-end (copy-marker end))
2638 (line-start (copy-marker start))
2639 recheck-region replace)
2640 (goto-char word-start)
2641 ;; Adjust the horizontal scroll & point
2642 (ispell-horiz-scroll)
2643 (goto-char (+ word-len word-start))
2644 (ispell-horiz-scroll)
2645 (goto-char word-start)
2646 (ispell-horiz-scroll)
2648 ;; Alignment cannot be tracked and this error will occur when
2649 ;; `query-replace' makes multiple corrections on the starting line.
2650 (if (/= (+ word-len (point))
2651 (progn
2652 ;; NB: Search can fail with Mule character sets that don't
2653 ;; display properly. Ignore the error in this case?
2654 (search-forward (car poss) (+ word-len (point)) t)
2655 (point)))
2656 ;; This occurs due to filter pipe problems
2657 (error (concat "Ispell misalignment: word "
2658 "`%s' point %d; probably incompatible versions")
2659 (car poss) (marker-position word-start)))
2660 ;; ispell-cmd-loop can go recursive & change buffer
2661 (if ispell-keep-choices-win
2662 (setq replace (ispell-command-loop
2663 (car (cdr (cdr poss)))
2664 (car (cdr (cdr (cdr poss))))
2665 (car poss) (marker-position word-start)
2666 (+ word-len (marker-position word-start))))
2667 (save-window-excursion
2668 (setq replace (ispell-command-loop
2669 (car (cdr (cdr poss)))
2670 (car (cdr (cdr (cdr poss))))
2671 (car poss) (marker-position word-start)
2672 (+ word-len (marker-position word-start))))))
2674 (goto-char word-start)
2675 ;; Recheck when query replace edit changes misspelled word.
2676 ;; Error in tex mode when a potential math mode change exists.
2677 (if (and replace (listp replace) (= 2 (length replace)))
2678 (if (and (eq ispell-parser 'tex)
2679 (string-match "[\\\\][]()[]\\|\\\\begin\\|\\$"
2680 (regexp-quote string)))
2681 (error
2682 "Don't start query replace on a line with math characters"
2684 (set-marker line-end (point))
2685 (setq ispell-filter nil
2686 recheck-region t)))
2688 ;; insert correction if needed
2689 (cond
2690 ((or (null replace)
2691 (equal 0 replace)) ; ACCEPT/INSERT
2692 (if (equal 0 replace) ; BUFFER-LOCAL DICT ADD
2693 (ispell-add-per-file-word-list (car poss)))
2694 ;; do not recheck accepted word on this line
2695 (setq accept-list (cons (car poss) accept-list)))
2696 (t ; replacement word selected or entered
2697 (delete-region (point) (+ word-len (point)))
2698 (if (not (listp replace))
2699 (progn
2700 (insert replace) ; insert dictionary word
2701 (setq accept-list (cons replace accept-list)))
2702 (let ((replace-word (car replace)))
2703 ;; Recheck hand entered replacement word
2704 (insert replace-word)
2705 (if (car (cdr replace))
2706 (save-window-excursion
2707 (delete-other-windows) ; to correctly show help.
2708 ;; Assume case-replace &
2709 ;; case-fold-search correct?
2710 (query-replace (car poss) (car replace) t)))
2711 (goto-char word-start)
2712 ;; do not recheck if already accepted
2713 (if (member replace-word accept-list)
2714 (setq accept-list (cons replace-word accept-list)
2715 replace replace-word)
2716 (let ((region-end (copy-marker ispell-region-end)))
2717 (setq recheck-region ispell-filter
2718 ispell-filter nil ; save filter
2719 shift 0 ; already accounted
2720 shift (ispell-region
2721 word-start
2722 (+ word-start (length replace-word))
2723 t shift))
2724 (if (null shift) ; quitting check.
2725 (setq shift 0))
2726 (set-marker ispell-region-end region-end)
2727 (set-marker region-end nil)
2728 (setq ispell-filter recheck-region
2729 recheck-region nil
2730 replace replace-word)))))
2732 (setq shift (+ shift (- (length replace) word-len)))
2734 ;; Move line-start across word...
2735 ;; new shift function does this now...
2736 ;;(set-marker line-start (+ line-start
2737 ;; (- (length replace)
2738 ;; (length (car poss)))))
2740 (if (not ispell-quit)
2741 (let (message-log-max)
2742 (message "Continuing spelling check using %s dictionary..."
2743 (or ispell-dictionary "default"))))
2744 (sit-for 0)
2745 (setq start (marker-position line-start)
2746 end (marker-position line-end))
2747 ;; Adjust markers when end of region lost from highlighting.
2748 (if (and (not recheck-region) (< end (+ word-start word-len)))
2749 (setq end (+ word-start word-len)))
2750 (if (= word-start ispell-region-end)
2751 (set-marker ispell-region-end (+ word-start word-len)))
2752 ;; going out of scope - unneeded
2753 (set-marker line-start nil)
2754 (set-marker word-start nil)
2755 (set-marker line-end nil)))
2756 ;; finished with misspelling!
2757 (setq ispell-filter (cdr ispell-filter)))
2758 shift))
2761 ;;;###autoload
2762 (defun ispell-comments-and-strings ()
2763 "Check comments and strings in the current buffer for spelling errors."
2764 (interactive)
2765 (goto-char (point-min))
2766 (let (state done)
2767 (while (not done)
2768 (setq done t)
2769 (setq state (parse-partial-sexp (point) (point-max)
2770 nil nil state 'syntax-table))
2771 (if (or (nth 3 state) (nth 4 state))
2772 (let ((start (point)))
2773 (setq state (parse-partial-sexp start (point-max)
2774 nil nil state 'syntax-table))
2775 (if (or (nth 3 state) (nth 4 state))
2776 (error "Unterminated string or comment"))
2777 (save-excursion
2778 (setq done (not (ispell-region start (point))))))))))
2781 ;;;###autoload
2782 (defun ispell-buffer ()
2783 "Check the current buffer for spelling errors interactively."
2784 (interactive)
2785 (ispell-region (point-min) (point-max)))
2788 ;;;###autoload
2789 (defun ispell-continue ()
2790 "Continue a halted spelling session beginning with the current word."
2791 (interactive)
2792 (if (not (marker-position ispell-region-end))
2793 (message "No session to continue. Use 'X' command when checking!")
2794 (if (not (equal (marker-buffer ispell-region-end) (current-buffer)))
2795 (message "Must continue ispell from buffer %s"
2796 (buffer-name (marker-buffer ispell-region-end)))
2797 (ispell-region
2798 ;; find beginning of current word:
2799 (car (cdr (ispell-get-word t)))
2800 (marker-position ispell-region-end)))))
2803 ;;; Horizontal scrolling
2804 (defun ispell-horiz-scroll ()
2805 "Places point within the horizontal visibility of its window area."
2806 (if truncate-lines ; display truncating lines?
2807 ;; See if display needs to be scrolled.
2808 (let ((column (- (current-column) (max (window-hscroll) 1))))
2809 (if (and (< column 0) (> (window-hscroll) 0))
2810 (scroll-right (max (- column) 10))
2811 (if (>= column (- (window-width) 2))
2812 (scroll-left (max (- column (window-width) -3) 10)))))))
2815 ;;; Interactive word completion.
2816 ;;; Forces "previous-word" processing. Do we want to make this selectable?
2818 ;;;###autoload
2819 (defun ispell-complete-word (&optional interior-frag)
2820 "Try to complete the word before or under point (see `lookup-words').
2821 If optional INTERIOR-FRAG is non-nil then the word may be a character
2822 sequence inside of a word.
2824 Standard ispell choices are then available."
2825 (interactive "P")
2826 (let ((cursor-location (point))
2827 (case-fold-search-val case-fold-search)
2828 (word (ispell-get-word nil "\\*")) ; force "previous-word" processing.
2829 start end possibilities replacement)
2830 (setq start (car (cdr word))
2831 end (car (cdr (cdr word)))
2832 word (car word)
2833 possibilities
2834 (or (string= word "") ; Will give you every word
2835 (lookup-words (concat (and interior-frag "*") word
2836 (if (or interior-frag (null ispell-look-p))
2837 "*"))
2838 ispell-complete-word-dict)))
2839 (cond ((eq possibilities t)
2840 (message "No word to complete"))
2841 ((null possibilities)
2842 (message "No match for \"%s\"" word))
2843 (t ; There is a modification...
2844 (setq case-fold-search nil) ; Try and respect case of word.
2845 (cond
2846 ((string-equal (upcase word) word)
2847 (setq possibilities (mapcar 'upcase possibilities)))
2848 ((string-equal (upcase (substring word 0 1)) (substring word 0 1))
2849 (setq possibilities (mapcar (function
2850 (lambda (pos)
2851 (if (string-equal
2852 (substring word 0 1)
2853 (substring pos 0 1))
2855 (capitalize pos))))
2856 possibilities))))
2857 (setq case-fold-search case-fold-search-val)
2858 (save-window-excursion
2859 (setq replacement
2860 (ispell-command-loop possibilities nil word start end)))
2861 (cond
2862 ((equal 0 replacement) ; BUFFER-LOCAL ADDITION
2863 (ispell-add-per-file-word-list word))
2864 (replacement ; REPLACEMENT WORD
2865 (delete-region start end)
2866 (setq word (if (atom replacement) replacement (car replacement))
2867 cursor-location (+ (- (length word) (- end start))
2868 cursor-location))
2869 (insert word)
2870 (if (not (atom replacement)) ; recheck spelling of replacement.
2871 (progn
2872 (goto-char cursor-location)
2873 (ispell-word nil t)))))
2874 (if (get-buffer ispell-choices-buffer)
2875 (kill-buffer ispell-choices-buffer))))
2876 (ispell-pdict-save ispell-silently-savep)
2877 (goto-char cursor-location)))
2880 ;;;###autoload
2881 (defun ispell-complete-word-interior-frag ()
2882 "Completes word matching character sequence inside a word."
2883 (interactive)
2884 (ispell-complete-word t))
2887 ;;;###autoload
2888 (defun ispell ()
2889 "Interactively check a region or buffer for spelling errors.
2890 If `transient-mark-mode' is on, and a region is active, spell-check
2891 that region. Otherwise spell-check the buffer.
2893 Ispell dictionaries are not distributed with Emacs. If you are
2894 looking for a dictionary, please see the distribution of the GNU ispell
2895 program, or do an Internet search; there are various dictionaries
2896 available on the net."
2897 (interactive)
2898 (if (and transient-mark-mode mark-active)
2899 (ispell-region (region-beginning) (region-end))
2900 (ispell-buffer)))
2903 ;;; **********************************************************************
2904 ;;; Ispell Minor Mode
2905 ;;; **********************************************************************
2907 (defvar ispell-minor-mode nil
2908 "Non-nil if Ispell minor mode is enabled.")
2909 ;; Variable indicating that ispell minor mode is active.
2910 (make-variable-buffer-local 'ispell-minor-mode)
2912 (or (assq 'ispell-minor-mode minor-mode-alist)
2913 (setq minor-mode-alist
2914 (cons '(ispell-minor-mode " Spell") minor-mode-alist)))
2916 (defvar ispell-minor-keymap
2917 (let ((map (make-sparse-keymap)))
2918 (define-key map " " 'ispell-minor-check)
2919 (define-key map "\r" 'ispell-minor-check)
2920 map)
2921 "Keymap used for Ispell minor mode.")
2923 (or (not (boundp 'minor-mode-map-alist))
2924 (assoc 'ispell-minor-mode minor-mode-map-alist)
2925 (setq minor-mode-map-alist
2926 (cons (cons 'ispell-minor-mode ispell-minor-keymap)
2927 minor-mode-map-alist)))
2929 ;;;###autoload
2930 (defun ispell-minor-mode (&optional arg)
2931 "Toggle Ispell minor mode.
2932 With prefix arg, turn Ispell minor mode on iff arg is positive.
2934 In Ispell minor mode, pressing SPC or RET
2935 warns you if the previous word is incorrectly spelled.
2937 All the buffer-local variables and dictionaries are ignored -- to read
2938 them into the running ispell process, type \\[ispell-word] SPC."
2939 (interactive "P")
2940 (setq ispell-minor-mode
2941 (not (or (and (null arg) ispell-minor-mode)
2942 (<= (prefix-numeric-value arg) 0))))
2943 (force-mode-line-update))
2945 (defun ispell-minor-check ()
2946 "Check previous word then continue with the normal binding of this key.
2947 Don't check previous word when character before point is a space or newline.
2948 Don't read buffer-local settings or word lists."
2949 (interactive "*")
2950 (let ((ispell-minor-mode nil)
2951 (ispell-check-only t)
2952 (last-char (char-after (1- (point)))))
2953 (command-execute (key-binding (this-command-keys)))
2954 (if (not (or (eq last-char ?\ ) (eq last-char ?\n)
2955 (and ispell-skip-html (eq last-char ?>))
2956 (and ispell-skip-html (eq last-char ?\;))))
2957 (ispell-word nil t))))
2960 ;;; **********************************************************************
2961 ;;; Ispell Message
2962 ;;; **********************************************************************
2963 ;;; Original from D. Quinlan, E. Bradford, A. Albert, and M. Ernst
2966 (defvar ispell-message-text-end
2967 (mapconcat (function identity)
2969 ;; Don't spell check signatures
2970 "^-- $"
2971 ;; Matches postscript files.
2972 "^%!PS-Adobe-[123].0"
2973 ;; Matches uuencoded text
2974 "^begin [0-9][0-9][0-9] .*\nM.*\nM.*\nM"
2975 ;; Matches shell files (especially auto-decoding)
2976 "^#! /bin/[ck]?sh"
2977 ;; Matches context difference listing
2978 "\\(\\(^cd .*\n\\)?diff -c .*\\)?\n\\*\\*\\* .*\n--- .*\n\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*"
2979 ;; Matches unidiff difference listing
2980 "\\(diff -u .*\\)?\n--- .*\n\\+\\+\\+ .*\n@@ [-+][0-9]+,[0-9]+ [-+][0-9]+,[0-9]+ @@\n"
2981 ;; Matches reporter.el bug report
2982 "^current state:\n==============\n"
2983 ;; Matches commonly used "cut" boundaries
2984 "^\\(- \\)?[-=_]+\\s ?\\(cut here\\|Environment Follows\\)")
2985 "\\|")
2986 "*End of text which will be checked in `ispell-message'.
2987 If it is a string, limit at first occurrence of that regular expression.
2988 Otherwise, it must be a function which is called to get the limit.")
2992 ;;;###autoload
2993 (defun ispell-message ()
2994 "Check the spelling of a mail message or news post.
2995 Don't check spelling of message headers except the Subject field.
2996 Don't check included messages.
2998 To abort spell checking of a message region and send the message anyway,
2999 use the `x' command. (Any subsequent regions will be checked.)
3000 The `X' command aborts the message send so that you can edit the buffer.
3002 To spell-check whenever a message is sent, include the appropriate lines
3003 in your .emacs file:
3004 (add-hook 'message-send-hook 'ispell-message) ;; GNUS 5
3005 (add-hook 'news-inews-hook 'ispell-message) ;; GNUS 4
3006 (add-hook 'mail-send-hook 'ispell-message)
3007 (add-hook 'mh-before-send-letter-hook 'ispell-message)
3009 You can bind this to the key C-c i in GNUS or mail by adding to
3010 `news-reply-mode-hook' or `mail-mode-hook' the following lambda expression:
3011 (function (lambda () (local-set-key \"\\C-ci\" 'ispell-message)))"
3012 (interactive)
3013 (save-excursion
3014 (goto-char (point-min))
3015 (let* (
3016 ;; Nil when message came from outside (eg calling emacs as editor)
3017 ;; Non-nil marker of end of headers.
3018 (internal-messagep
3019 (re-search-forward
3020 (concat "^" (regexp-quote mail-header-separator) "$") nil t))
3021 (end-of-headers ; Start of body.
3022 (copy-marker
3023 (or internal-messagep
3024 (re-search-forward "^$" nil t)
3025 (point-min))))
3026 (limit (copy-marker ; End of region we will spell check.
3027 (cond
3028 ((not ispell-message-text-end) (point-max))
3029 ((char-or-string-p ispell-message-text-end)
3030 (if (re-search-forward ispell-message-text-end nil t)
3031 (match-beginning 0)
3032 (point-max)))
3033 (t (min (point-max) (funcall ispell-message-text-end))))))
3034 (default-prefix ; Vanilla cite prefix (just used for cite-regexp)
3035 (if (and (boundp 'mail-yank-prefix) mail-yank-prefix)
3036 (ispell-non-empty-string mail-yank-prefix)
3037 " \\|\t"))
3038 (cite-regexp ;Prefix of quoted text
3039 (cond
3040 ((functionp 'sc-cite-regexp) ; sc 3.0
3041 (concat "\\(" (sc-cite-regexp) "\\)" "\\|"
3042 (ispell-non-empty-string sc-reference-tag-string)))
3043 ((boundp 'sc-cite-regexp) ; sc 2.3
3044 (concat "\\(" sc-cite-regexp "\\)" "\\|"
3045 (ispell-non-empty-string sc-reference-tag-string)))
3046 ((or (equal major-mode 'news-reply-mode) ;GNUS 4 & below
3047 (equal major-mode 'message-mode)) ;GNUS 5
3048 (concat "In article <" "\\|"
3049 "[^,;&+=\n]+ <[^,;&+=]+> writes:" "\\|"
3050 message-yank-prefix "\\|"
3051 default-prefix))
3052 ((equal major-mode 'mh-letter-mode) ; mh mail message
3053 (concat "[^,;&+=\n]+ writes:" "\\|"
3054 (ispell-non-empty-string mh-ins-buf-prefix)))
3055 ((not internal-messagep) ; Assume nn sent us this message.
3056 (concat "In [a-zA-Z.]+ you write:" "\\|"
3057 "In <[^,;&+=]+> [^,;&+=]+ writes:" "\\|"
3058 " *> *"))
3059 ((boundp 'vm-included-text-prefix) ; VM mail message
3060 (concat "[^,;&+=\n]+ writes:" "\\|"
3061 (ispell-non-empty-string vm-included-text-prefix)))
3062 (t default-prefix)))
3063 (ispell-skip-region-alist
3064 (cons (list (concat "^\\(" cite-regexp "\\)")
3065 (function forward-line))
3066 ispell-skip-region-alist))
3067 (old-case-fold-search case-fold-search)
3068 (dictionary-alist ispell-message-dictionary-alist)
3069 (ispell-checking-message t))
3071 ;; Select dictionary for message
3072 (or (local-variable-p 'ispell-local-dictionary (current-buffer))
3073 (while dictionary-alist
3074 (goto-char (point-min))
3075 (if (re-search-forward (car (car dictionary-alist))
3076 end-of-headers t)
3077 (setq ispell-local-dictionary (cdr (car dictionary-alist))
3078 dictionary-alist nil)
3079 (setq dictionary-alist (cdr dictionary-alist)))))
3081 (unwind-protect
3082 (progn
3083 ;; Spell check any original Subject:
3084 (goto-char (point-min))
3085 (setq case-fold-search t)
3086 (if (re-search-forward "^Subject: *" end-of-headers t)
3087 (progn
3088 (goto-char (match-end 0))
3089 (if (and (not (looking-at ".*Re\\>"))
3090 (not (looking-at "\\[")))
3091 (progn
3092 (setq case-fold-search old-case-fold-search)
3093 (ispell-region (point)
3094 (progn ;Tab-initiated continuation lns.
3095 (end-of-line)
3096 (while (looking-at "\n[ \t]")
3097 (end-of-line 2))
3098 (point)))))))
3099 (setq case-fold-search old-case-fold-search)
3100 (goto-char end-of-headers)
3101 (forward-line 1)
3102 (ispell-region (point) limit))
3103 (set-marker end-of-headers nil)
3104 (set-marker limit nil)))))
3107 (defun ispell-non-empty-string (string)
3108 (if (or (not string) (string-equal string ""))
3109 "\\'\\`" ; An unmatchable string if string is null.
3110 (regexp-quote string)))
3113 ;;; **********************************************************************
3114 ;;; Buffer Local Functions
3115 ;;; **********************************************************************
3118 (defun ispell-accept-buffer-local-defs ()
3119 "Load all buffer-local information, restarting Ispell when necessary."
3120 (ispell-buffer-local-dict) ; May kill ispell-process.
3121 (ispell-buffer-local-words) ; Will initialize ispell-process.
3122 (ispell-buffer-local-parsing))
3125 (defun ispell-buffer-local-parsing ()
3126 "Place Ispell into parsing mode for this buffer.
3127 Overrides the default parsing mode.
3128 Includes Latex/Nroff modes and extended character mode."
3129 ;; (ispell-init-process) must already be called.
3130 (ispell-send-string "!\n") ; Put process in terse mode.
3131 ;; We assume all major modes with "tex-mode" in them should use latex parsing
3132 ;; When exclusively checking comments, set to raw text mode (nroff).
3133 (if (and (not (eq 'exclusive ispell-check-comments))
3134 (or (and (eq ispell-parser 'use-mode-name)
3135 (string-match "[Tt][Ee][Xx]-mode"
3136 (symbol-name major-mode)))
3137 (eq ispell-parser 'tex)))
3138 (progn
3139 (ispell-send-string "+\n") ; set ispell mode to tex
3140 (if (not (eq ispell-parser 'tex))
3141 (set (make-local-variable 'ispell-parser) 'tex)))
3142 (ispell-send-string "-\n")) ; set mode to normal (nroff)
3143 ;; If needed, test for SGML & HTML modes and set a buffer local nil/t value.
3144 (if (and ispell-skip-html (not (eq ispell-skip-html t)))
3145 (set (make-local-variable 'ispell-skip-html)
3146 (not (null (string-match "sgml\\|html\\|xml"
3147 (downcase (symbol-name major-mode)))))))
3148 ;; Set default extended character mode for given buffer, if any.
3149 (let ((extended-char-mode (ispell-get-extended-character-mode)))
3150 (if extended-char-mode
3151 (ispell-send-string (concat extended-char-mode "\n"))))
3152 ;; Set buffer-local parsing mode and extended character mode, if specified.
3153 (save-excursion
3154 (goto-char (point-max))
3155 ;; Uses last occurrence of ispell-parsing-keyword
3156 (if (search-backward ispell-parsing-keyword nil t)
3157 (let ((end (save-excursion (end-of-line) (point)))
3158 string)
3159 (search-forward ispell-parsing-keyword)
3160 (while (re-search-forward " *\\([^ \"]+\\)" end t)
3161 ;; space separated definitions.
3162 (setq string (downcase (buffer-substring-no-properties
3163 (match-beginning 1) (match-end 1))))
3164 (cond ((and (string-match "latex-mode" string)
3165 (not (eq 'exclusive ispell-check-comments)))
3166 (ispell-send-string "+\n~tex\n"))
3167 ((string-match "nroff-mode" string)
3168 (ispell-send-string "-\n~nroff\n"))
3169 ((string-match "~" string) ; Set extended character mode.
3170 (ispell-send-string (concat string "\n")))
3171 (t (message "Invalid Ispell Parsing argument!")
3172 (sit-for 2))))))))
3175 ;;; Can kill the current ispell process
3177 (defun ispell-buffer-local-dict ()
3178 "Initializes local dictionary and local personal dictionary.
3179 When a dictionary is defined in the buffer (see variable
3180 `ispell-dictionary-keyword'), it will override the local setting
3181 from \\[ispell-change-dictionary].
3182 Both should not be used to define a buffer-local dictionary."
3183 (save-excursion
3184 (goto-char (point-min))
3185 (let (end)
3186 ;; Override the local variable definition.
3187 ;; Uses last occurrence of ispell-dictionary-keyword.
3188 (goto-char (point-max))
3189 (if (search-backward ispell-dictionary-keyword nil t)
3190 (progn
3191 (search-forward ispell-dictionary-keyword)
3192 (setq end (save-excursion (end-of-line) (point)))
3193 (if (re-search-forward " *\\([^ \"]+\\)" end t)
3194 (setq ispell-local-dictionary
3195 (buffer-substring-no-properties (match-beginning 1)
3196 (match-end 1))))))
3197 (goto-char (point-max))
3198 (if (search-backward ispell-pdict-keyword nil t)
3199 (progn
3200 (search-forward ispell-pdict-keyword)
3201 (setq end (save-excursion (end-of-line) (point)))
3202 (if (re-search-forward " *\\([^ \"]+\\)" end t)
3203 (setq ispell-local-pdict
3204 (buffer-substring-no-properties (match-beginning 1)
3205 (match-end 1))))))))
3206 ;; Reload if new personal dictionary defined.
3207 (if (and ispell-local-pdict
3208 (not (equal ispell-local-pdict ispell-personal-dictionary)))
3209 (progn
3210 (ispell-kill-ispell t)
3211 (setq ispell-personal-dictionary ispell-local-pdict)))
3212 ;; Reload if new dictionary defined.
3213 (if (and ispell-local-dictionary
3214 (not (equal ispell-local-dictionary ispell-dictionary)))
3215 (ispell-change-dictionary ispell-local-dictionary)))
3218 (defun ispell-buffer-local-words ()
3219 "Loads the buffer-local dictionary in the current buffer."
3220 (if (and ispell-buffer-local-name
3221 (not (equal ispell-buffer-local-name (buffer-name))))
3222 (progn
3223 (ispell-kill-ispell t)
3224 (setq ispell-buffer-local-name nil)))
3225 (ispell-init-process)
3226 (save-excursion
3227 (goto-char (point-min))
3228 (while (search-forward ispell-words-keyword nil t)
3229 (or ispell-buffer-local-name
3230 (setq ispell-buffer-local-name (buffer-name)))
3231 (let ((end (save-excursion (end-of-line) (point)))
3232 (ispell-casechars (ispell-get-casechars))
3233 string)
3234 ;; buffer-local words separated by a space, and can contain
3235 ;; any character other than a space. Not rigorous enough.
3236 (while (re-search-forward " *\\([^ ]+\\)" end t)
3237 (setq string (buffer-substring-no-properties (match-beginning 1)
3238 (match-end 1)))
3239 ;; This can fail when string contains a word with illegal chars.
3240 ;; Error handling needs to be added between ispell and emacs.
3241 (if (and (< 1 (length string))
3242 (equal 0 (string-match ispell-casechars string)))
3243 (ispell-send-string (concat "@" string "\n"))))))))
3246 ;;; returns optionally adjusted region-end-point.
3248 (defun ispell-add-per-file-word-list (word)
3249 "Add WORD to the per-file word list."
3250 (or ispell-buffer-local-name
3251 (setq ispell-buffer-local-name (buffer-name)))
3252 (save-excursion
3253 (goto-char (point-min))
3254 (let ((old-case-fold-search case-fold-search)
3255 line-okay search done found)
3256 (while (not done)
3257 (setq case-fold-search nil
3258 search (search-forward ispell-words-keyword nil 'move)
3259 found (or found search)
3260 line-okay (< (+ (length word) 1 ; 1 for space after word..
3261 (progn (end-of-line) (current-column)))
3263 case-fold-search old-case-fold-search)
3264 (if (or (and search line-okay)
3265 (null search))
3266 (progn
3267 (setq done t)
3268 (if (null search)
3269 (progn
3270 (open-line 1)
3271 (unless found (newline))
3272 (insert (concat comment-start " " ispell-words-keyword))
3273 (if (> (length comment-end) 0)
3274 (save-excursion
3275 (newline)
3276 (insert comment-end)))))
3277 (insert (concat " " word))))))))
3279 (add-to-list 'debug-ignored-errors "^No word found to check!$")
3281 (provide 'ispell)
3284 ;;; LOCAL VARIABLES AND BUFFER-LOCAL VALUE EXAMPLES.
3286 ;;; Local Variable options:
3287 ;;; mode: name(-mode)
3288 ;;; eval: expression
3289 ;;; local-variable: value
3291 ;;; The following sets the buffer local dictionary to `american' English
3292 ;;; and spell checks only comments.
3294 ;;; Local Variables:
3295 ;;; mode: emacs-lisp
3296 ;;; comment-column: 40
3297 ;;; ispell-check-comments: exclusive
3298 ;;; ispell-local-dictionary: "american"
3299 ;;; End:
3302 ;;; MORE EXAMPLES OF ISPELL BUFFER-LOCAL VALUES
3304 ;;; The following places this file in nroff parsing and extended char modes.
3305 ;;; Local IspellParsing: nroff-mode ~nroff
3306 ;;; Change IspellPersDict to IspellPersDict: to enable the following line.
3307 ;;; Local IspellPersDict ~/.ispell_lisp
3308 ;;; The following were automatically generated by ispell using the 'A' command:
3309 ; LocalWords: settable alist inews mh frag pdict Wildcards iconify arg tex kss
3310 ; LocalWords: alists minibuffer bufferp autoload loaddefs aff Dansk KOI SPC op
3311 ; LocalWords: Francais Nederlands charset autoloaded popup nonmenu regexp num
3312 ; LocalWords: AMStex hspace includeonly nocite epsfig displaymath eqnarray reg
3313 ; LocalWords: minipage modeline pers dict unhighlight buf grep sync prev inc
3314 ; LocalWords: fn hilight oldot NB AIX msg init read's bufs pt cmd Quinlan eg
3315 ; LocalWords: uuencoded unidiff sc nn VM SGML eval IspellPersDict unsplitable
3316 ; LocalWords: lns XEmacs HTML casechars Multibyte
3318 ;;; ispell.el ends here