Mercurial > emacs
comparison lisp/textmodes/ispell.el @ 23791:364d36c8f631
Improved and fixed customize for variables:
ispell-highlight-p, ispell-check-comments, ispell-help-in-bufferp,
ispell-dictionary-alist, ispell-skip-sgml.
Improved and fixed comments in variables and messages for
functions: ispell-help-in-bufferp, ispell-local-dictionary,
ispell-menu-map, ispell-checking-message, ispell-parser,
ispell-word, lookup-words, ispell-change-dictionary, ispell-region,
ispell-begin-tex-skip-regexp, ispell-begin-skip-region,
ispell-comments-and-strings, ispell-continue, ispell-complete-word,
ispell-message-text-end, ispell-add-per-file-word-list.
(ispell-dictionary-alist-1): (ispell-dictionary-alist2): A coding
system is now required for all languages. Casechars improved for
castellano, castellano8, and norsk dictionaries. Dictionary
norsk7-tex removed. Dictionary polish added.
(ispell-dictionary-alist): Redefined at load-time to support
dictionary changes.
(ispell-menu-map): Redefined at load-time to support menu changes.
(ispell-check-version): New alias for `check-ispell-version'.
(ispell-parse-output): Fixed matching for ispell error messages.
Correctly returns spelling suggestions in order generated by ispell process.
(check-ispell-version): Ensure `case-fold-search' doesn't get redefined.
(ispell-complete-word): Ensure `case-fold-search' doesn't get
redefined. Fix bug that didn't respect case of word being completed.
(ispell-init-process): Set process coding system to be compatible
with emacs processes and the ispell process.
(ispell-kill-ispell): Ensures ispell process has terminated before
starting new process. This can otherwise confuse process filters
and hang the ispell process.
(ispell-begin-skip-region-regexp): (ispell-skip-region): Improved
skipping support for sgml.
(ispell-minor-check): Support sgml labels. Fix mapping ^M to \r
which could cause `ispell-complete-word' to hang.
(ispell-message): Improved message reference matching. Ensure
`case-fold-search' doesn't get redefined.
(ispell-buffer-local-parsing): Ensure `case-fold-search' doesn't
get redefined. Fixed bug in returning to nroff mode from tex mode.
(ispell-add-per-file-word-list): Ensure `case-fold-search' doesn't
get redefined.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 01 Dec 1998 07:23:27 +0000 |
parents | 8540faafb684 |
children | f7665af4bdf8 |
comparison
equal
deleted
inserted
replaced
23790:c1dbb92db43e | 23791:364d36c8f631 |
---|---|
1 ;;; ispell.el --- Interface to International Ispell Version 3.1 | 1 ;;; ispell.el --- Interface to International Ispell Version 3.1 |
2 | 2 |
3 ;; Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Authors : Ken Stevens <k.stevens@ieee.org> | 5 ;; Authors : Ken Stevens <k.stevens@ieee.org> |
6 ;; Stevens Mod Date: Tue Apr 28 14:40:01 PDT 1998 | 6 ;; Stevens Mod Date: Mon Nov 30 20:32:48 PST 1998 |
7 ;; Stevens Revision: 3.0 | 7 ;; Stevens Revision: 3.1 |
8 ;; Status : Release with 3.1.12+ ispell. | 8 ;; Status : Release with 3.1.12+ ispell. |
9 ;; Bug Reports : ispell-el-bugs@itcorp.com | 9 ;; Bug Reports : ispell-el-bugs@itcorp.com |
10 ;; Web Site : http://kdstevens.com/~stevens/ispell-page.html | 10 ;; Web Site : http://kdstevens.com/~stevens/ispell-page.html |
11 | 11 |
12 ;; This file is part of GNU Emacs. | 12 ;; This file is part of GNU Emacs. |
110 ;; spell check in `ispell-skip-region-alist'. Mode-dependent features can | 110 ;; spell check in `ispell-skip-region-alist'. Mode-dependent features can |
111 ;; be added to latex by modifying `ispell-tex-skip-alists'. | 111 ;; be added to latex by modifying `ispell-tex-skip-alists'. |
112 ;; `ispell-message' contains some custom skipping code for e-mail messages. | 112 ;; `ispell-message' contains some custom skipping code for e-mail messages. |
113 | 113 |
114 ;; BUGS: | 114 ;; BUGS: |
115 ;; Accepting definitions in latex mode can mess up math mode skipping... | |
115 ;; Highlighting in version 19 still doesn't work on tty's. | 116 ;; Highlighting in version 19 still doesn't work on tty's. |
116 ;; On some versions of emacs, growing the minibuffer fails. | 117 ;; On some versions of emacs, growing the minibuffer fails. |
117 ;; Autoloading ispell can result in problems if you need to use a local or | 118 ;; Autoloading ispell can result in problems if you need to use a local or |
118 ;; modified dictionary. Place the following in your .emacs file to | 119 ;; modified dictionary. Place the following in your .emacs file to |
119 ;; override the autoload definitions: | 120 ;; override the autoload definitions: |
120 ;; (setq ispell-dictionary-alist (cons '(dictionary ...) | 121 ;; (setq ispell-dictionary-alist (cons '(dictionary ...) |
121 ;; ispell-dictionary-alist)) | 122 ;; ispell-dictionary-alist)) |
122 ;; (setq ispell-menu-map nil) | 123 ;; (setq ispell-menu-map nil) |
123 ;; (load-library "ispell") | 124 ;; (load-library "ispell") |
124 | 125 |
126 | |
125 ;;; Code: | 127 ;;; Code: |
126 | 128 |
127 ;;; Custom.el macros require recompiling this when they are not present. | 129 ;;; Custom.el macros require recompiling this when they are not present. |
128 ;;; Add in backward compatible custom support. | 130 ;;; Add in backward compatible custom support. |
129 (eval-when-compile | 131 (eval-when-compile |
149 ;;; Code: | 151 ;;; Code: |
150 | 152 |
151 (defcustom ispell-highlight-p 'block | 153 (defcustom ispell-highlight-p 'block |
152 "*Highlight spelling errors when non-nil. | 154 "*Highlight spelling errors when non-nil. |
153 When set to `block', assumes a block cursor with TTY displays." | 155 When set to `block', assumes a block cursor with TTY displays." |
154 :type '(choice (const block) (const nil) (other :tag "on" t)) | 156 :type '(choice (const block) (const :tag "off" nil) (const :tag "on" t)) |
155 :group 'ispell) | 157 :group 'ispell) |
156 | 158 |
157 (defcustom ispell-highlight-face 'highlight | 159 (defcustom ispell-highlight-face 'highlight |
158 "*The face used for Ispell highlighting. For Emacses with overlays. | 160 "*The face used for Ispell highlighting. For Emacses with overlays. |
159 Possible values are `highlight', `modeline', `secondary-selection', | 161 Possible values are `highlight', `modeline', `secondary-selection', |
167 (defcustom ispell-check-comments t | 169 (defcustom ispell-check-comments t |
168 "*Spelling of comments checked when non-nil. | 170 "*Spelling of comments checked when non-nil. |
169 When set to `exclusive', ONLY comments are checked. (For code comments). | 171 When set to `exclusive', ONLY comments are checked. (For code comments). |
170 Warning! Not checking comments, when a comment start is embedded in strings, | 172 Warning! Not checking comments, when a comment start is embedded in strings, |
171 may produce undesired results." | 173 may produce undesired results." |
172 :type '(choice (const exclusive) (const nil) (other :tag "on" t)) | 174 :type '(choice (const exclusive) (const :tag "off" nil) (const :tag "on" t)) |
173 :group 'ispell) | 175 :group 'ispell) |
174 | 176 |
175 (defcustom ispell-query-replace-choices nil | 177 (defcustom ispell-query-replace-choices nil |
176 "*Corrections made throughout region when non-nil. | 178 "*Corrections made throughout region when non-nil. |
177 Uses `query-replace' (\\[query-replace]) for corrections." | 179 Uses `query-replace' (\\[query-replace]) for corrections." |
291 :type 'boolean | 293 :type 'boolean |
292 :group 'ispell) | 294 :group 'ispell) |
293 | 295 |
294 (defcustom ispell-help-in-bufferp nil | 296 (defcustom ispell-help-in-bufferp nil |
295 "*Non-nil means display interactive keymap help in a buffer. | 297 "*Non-nil means display interactive keymap help in a buffer. |
296 The following valued are supported: | 298 The following values are supported: |
297 nil Expand the minibuffer and display a short help message | 299 nil Expand the minibuffer and display a short help message |
298 there for a couple of seconds. | 300 there for a couple of seconds. |
299 t Pop up a new buffer and display a short help message there | 301 t Pop up a new buffer and display a short help message there |
300 for a couple of seconds. | 302 for a couple of seconds. |
301 electric Pop up a new buffer and display a long help message there. | 303 electric Pop up a new buffer and display a long help message there. |
302 User can browse and then exit the help mode." | 304 User can browse and then exit the help mode." |
303 :type '(choice (const electric) (const nil) (other :tag "t" t)) | 305 :type '(choice (const electric) (const :tag "off" nil) (const :tag "on" t)) |
304 | |
305 :group 'ispell) | 306 :group 'ispell) |
306 | 307 |
307 (defcustom ispell-quietly nil | 308 (defcustom ispell-quietly nil |
308 "*Non-nil means suppress messages in `ispell-word'." | 309 "*Non-nil means suppress messages in `ispell-word'." |
309 :type 'boolean | 310 :type 'boolean |
342 (defcustom ispell-local-dictionary nil | 343 (defcustom ispell-local-dictionary nil |
343 "If non-nil, the dictionary to be used for Ispell commands. | 344 "If non-nil, the dictionary to be used for Ispell commands. |
344 The value must be a string dictionary name in `ispell-dictionary-alist'. | 345 The value must be a string dictionary name in `ispell-dictionary-alist'. |
345 This variable becomes buffer-local when set in any fashion. | 346 This variable becomes buffer-local when set in any fashion. |
346 | 347 |
347 Setting ispell-local-dictionary to a value has the same effect as | 348 Setting `ispell-local-dictionary' to a value has the same effect as |
348 calling \\[ispell-change-dictionary] with that value. This variable | 349 calling \\[ispell-change-dictionary] with that value. This variable |
349 is automatically set when defined in the file with either | 350 is automatically set when defined in the file with either |
350 `ispell-dictionary-keyword' or the Local Variable syntax. | 351 `ispell-dictionary-keyword' or the Local Variable syntax. |
351 | 352 |
352 To create a non-standard default dictionary (not from ispell-dictionary-alist) | 353 To create a non-standard default dictionary (not from `ispell-dictionary-alist') |
353 call function set-default with the new dictionary name." | 354 call function `set-default' with the new dictionary name." |
354 :type '(choice string | 355 :type '(choice string |
355 (const :tag "default" nil)) | 356 (const :tag "default" nil)) |
356 :group 'ispell) | 357 :group 'ispell) |
357 | 358 |
358 (make-variable-buffer-local 'ispell-local-dictionary) | 359 (make-variable-buffer-local 'ispell-local-dictionary) |
367 words as correct. See also `ispell-dictionary-alist', which may be used | 368 words as correct. See also `ispell-dictionary-alist', which may be used |
368 for language-specific arguments." | 369 for language-specific arguments." |
369 :type '(repeat string) | 370 :type '(repeat string) |
370 :group 'ispell) | 371 :group 'ispell) |
371 | 372 |
372 ;;; The preparation of the menu bar menu must be autoloaded | |
373 ;;; because otherwise this file gets autoloaded every time Emacs starts | |
374 ;;; so that it can set up the menus and determine keyboard equivalents. | |
375 | |
376 ;;; split dictionary so line length is smaller in loaddefs.el | 373 ;;; split dictionary so line length is smaller in loaddefs.el |
377 | 374 |
375 ;;; First half of dictionary, shortened for loaddefs.el | |
378 ;;;###autoload | 376 ;;;###autoload |
379 (defvar ispell-dictionary-alist-1 | 377 (setq |
380 '((nil ; default (English.aff) | 378 ispell-dictionary-alist-1 |
381 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil nil) | 379 '((nil ; default (English.aff) |
382 ("american" ; make English explicitly selectable | 380 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) |
383 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil nil) | 381 ("american" ; yankee English |
384 ("british" ; British version | 382 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) |
385 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "british") nil nil) | 383 ("british" ; British version |
386 ("castellano" ; Spanish mode | 384 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "british") nil iso-8859-1) |
387 "[A-Z\301\311\315\323\332\334\321a-z\341\351\355\363\372\374\361]" | 385 ("castellano" ; Spanish mode |
388 "[^A-Z\301\311\315\323\332\334\321a-z\341\351\355\363\372\374\361]" | 386 "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" |
389 "[---]" nil ("-B" "-d" "castellano") "~tex" iso-latin-1) | 387 "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" |
390 ("castellano8" ; 8 bit Spanish mode | 388 "[---]" nil ("-B" "-d" "castellano") "~tex" iso-8859-1) |
391 "[A-Z\301\311\315\323\332\334\321a-z\341\351\355\363\372\374\361]" | 389 ("castellano8" ; 8 bit Spanish mode |
392 "[^A-Z\301\311\315\323\332\334\321a-z\341\351\355\363\372\374\361]" | 390 "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" |
393 "[---]" nil ("-B" "-d" "castellano") "~latin1" iso-latin-1) | 391 "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" |
394 ("czech" | 392 "[---]" nil ("-B" "-d" "castellano") "~latin1" iso-8859-1) |
395 "[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]" | 393 ("czech" |
396 "[^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]" | 394 "[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]" |
397 "" nil ("-B" "-d" "czech") nil iso-latin-2) | 395 "[^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]" |
398 ("dansk" ; Dansk.aff | 396 "" nil ("-B" "-d" "czech") nil iso-8859-2) |
399 "[A-Z\306\330\305a-z\346\370\345]" "[^A-Z\306\330\305a-z\346\370\345]" | 397 ("dansk" ; Dansk.aff |
400 "[']" nil ("-C") nil iso-latin-1) | 398 "[A-Z\306\330\305a-z\346\370\345]" "[^A-Z\306\330\305a-z\346\370\345]" |
401 ("deutsch" ; Deutsch.aff | 399 "[']" nil ("-C") nil iso-8859-1) |
402 "[a-zA-Z\"]" "[^a-zA-Z\"]" "[']" t ("-C") "~tex" nil) | 400 ("deutsch" ; Deutsch.aff |
403 ("deutsch8" | 401 "[a-zA-Z\"]" "[^a-zA-Z\"]" "[']" t ("-C") "~tex" iso-8859-1) |
404 "[a-zA-Z\304\326\334\344\366\337\374]" | 402 ("deutsch8" |
405 "[^a-zA-Z\304\326\334\344\366\337\374]" | 403 "[a-zA-Z\304\326\334\344\366\337\374]" |
406 "[']" t ("-C" "-d" "deutsch") "~latin1" iso-latin-1) | 404 "[^a-zA-Z\304\326\334\344\366\337\374]" |
407 ("english" ; make English explicitly selectable | 405 "[']" t ("-C" "-d" "deutsch") "~latin1" iso-8859-1) |
408 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil nil)) | 406 ("english" ; make English explicitly selectable |
409 "First half of dictionary, shortened for loaddefs.el") | 407 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1))) |
410 | 408 |
409 | |
410 ;;; Second half of dictionary, shortened for loaddefs.el | |
411 ;;;###autoload | 411 ;;;###autoload |
412 (defvar ispell-dictionary-alist-2 | 412 (setq |
413 '(("esperanto" | 413 ispell-dictionary-alist-2 |
414 "[A-Za-z\246\254\266\274\306\330\335\336\346\370\375\376]" | 414 '(("esperanto" |
415 "[^A-Za-z\246\254\266\274\306\330\335\336\346\370\375\376]" | 415 "[A-Za-z\246\254\266\274\306\330\335\336\346\370\375\376]" |
416 "[-']" t ("-C") "~latin3" nil) | 416 "[^A-Za-z\246\254\266\274\306\330\335\336\346\370\375\376]" |
417 ("esperanto-tex" | 417 "[-']" t ("-C") "~latin3" iso-8859-1) |
418 "[A-Za-z^\\]" "[^A-Za-z^\\]" "[-'`\"]" t ("-C" "-d" "esperanto") "~tex" | 418 ("esperanto-tex" |
419 nil) | 419 "[A-Za-z^\\]" "[^A-Za-z^\\]" |
420 ("francais7" | 420 "[-'`\"]" t ("-C" "-d" "esperanto") "~tex" iso-8859-1) |
421 "[A-Za-z]" "[^A-Za-z]" "[`'^---]" t nil nil nil) | 421 ("francais7" |
422 ("francais" ; Francais.aff | 422 "[A-Za-z]" "[^A-Za-z]" "[`'^---]" t nil nil iso-8859-1) |
423 "[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]" | 423 ("francais" ; Francais.aff |
424 "[^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]" | 424 "[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]" |
425 "[---']" t nil "~list" iso-latin-1) | 425 "[^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]" |
426 ("francais-tex" ; Francais.aff | 426 "[---']" t nil "~list" iso-8859-1) |
427 "[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\\]" | 427 ("francais-tex" ; Francais.aff |
428 "[^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\\]" | 428 "[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\\]" |
429 "[---'^`\"]" t nil "~tex" iso-latin-1) | 429 "[^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\\]" |
430 ("nederlands" ; Nederlands.aff | 430 "[---'^`\"]" t nil "~tex" iso-8859-1) |
431 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" | 431 ("nederlands" ; Nederlands.aff |
432 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" | 432 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" |
433 "[']" t ("-C") nil iso-latin-1) | 433 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" |
434 ("nederlands8" ; Dutch8.aff | 434 "[']" t ("-C") nil iso-8859-1) |
435 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" | 435 ("nederlands8" ; Dutch8.aff |
436 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" | 436 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" |
437 "[']" t ("-C") nil iso-latin-1) | 437 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" |
438 ("norsk" ;8 bit Norwegian mode | 438 "[']" t ("-C") nil iso-8859-1) |
439 "[A-Za-z\351\346\370\345\350\364\362\311\306\330\305\310\324\322]" | 439 ("norsk" ; 8 bit Norwegian mode |
440 "[^A-Za-z\351\346\370\345\350\364\362\311\306\330\305\310\324\322]" | 440 "[A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]" |
441 "[']" nil ("-C" "-d" "norsk") "~list" nil) | 441 "[^A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]" |
442 ("russian" ; russian.aff (KOI8-R charset) | 442 "[\"]" nil ("-d" "norsk") "~list" iso-8859-1) |
443 "[\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]" | 443 ("norsk7-tex" ; 7 bit Norwegian TeX mode |
444 "[^\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]" | 444 "[A-Za-z{}\\'^`]" "[^A-Za-z{}\\'^`]" |
445 "[']" t ("-C" "-d" "russian") "~latin1" iso-latin-1) | 445 "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1) |
446 ("svenska" | 446 ("polish" ; polish mode |
447 "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" | 447 "[A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" |
448 "[']" nil ("-C") "~list" ; Add `"-T" "list"' instead? | 448 "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" |
449 iso-latin-1)) | 449 "" nil ( "-d" "polish") nil iso-8859-2) |
450 "Second half of dictionary, shortened for loaddefs.el") | 450 ("russian" ; russian.aff (KOI8-R charset) |
451 | 451 "[\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]" |
452 ;;; The preparation of the menu bar menu must be autoloaded | 452 "[^\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]" |
453 ;;; because otherwise this file gets autoloaded every time Emacs starts | 453 "[']" t ("-C" "-d" "russian") "~latin1" iso-8859-1) |
454 ;;; so that it can set up the menus and determine keyboard equivalents. | 454 ("svenska" ; Swedish mode |
455 "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" | |
456 "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]" | |
457 "[']" nil ("-C") "~list" iso-8859-1))) | |
458 | |
459 | |
455 | 460 |
456 ;;;###autoload | 461 ;;;###autoload |
457 (defcustom ispell-dictionary-alist | 462 (defcustom ispell-dictionary-alist |
458 (append ispell-dictionary-alist-1 ispell-dictionary-alist-2) | 463 (append ispell-dictionary-alist-1 ispell-dictionary-alist-2) |
459 "An alist of dictionaries and their associated parameters. | 464 "An alist of dictionaries and their associated parameters. |
510 (regexp :tag "Other characters") | 515 (regexp :tag "Other characters") |
511 (boolean :tag "Many other characters") | 516 (boolean :tag "Many other characters") |
512 (repeat :tag "Ispell command line args" | 517 (repeat :tag "Ispell command line args" |
513 (string :tag "Arg")) | 518 (string :tag "Arg")) |
514 (choice :tag "Extended character mode" | 519 (choice :tag "Extended character mode" |
515 (const "~tex") (const "~list") (const "~nroff") | 520 (const "~tex") (const "~plaintex") |
516 (const "~latin3") (const "~latin1") | 521 (const "~nroff") (const "~list") |
517 (const :tag "default" nil)) | 522 (const "~latin1") (const "~latin3") |
523 (const :tag "default" nil)) | |
518 (choice :tag "Character set" | 524 (choice :tag "Character set" |
519 (const iso-latin-1) | 525 (const iso-8859-1) |
520 (const iso-latin-2) | 526 (const iso-8859-2)))) |
521 (const :tag "default" nil)))) | |
522 :group 'ispell) | 527 :group 'ispell) |
523 | 528 |
529 ;;; update the dictionaries at load time | |
530 (eval-when (load) | |
531 (setq ispell-dictionary-alist | |
532 (append ispell-dictionary-alist-1 ispell-dictionary-alist-2))) | |
533 | |
534 | |
535 | |
536 ;;; The preparation of the menu bar menu must be autoloaded | |
537 ;;; because otherwise this file gets autoloaded every time Emacs starts | |
538 ;;; so that it can set up the menus and determine keyboard equivalents. | |
524 | 539 |
525 ;;;###autoload | 540 ;;;###autoload |
526 (defvar ispell-menu-map nil "Key map for ispell menu") | 541 (defvar ispell-menu-map nil "Key map for ispell menu.") |
542 ;;; redo menu when loading ispell to get dictionary modifications | |
543 (eval-when (load) (setq ispell-menu-map nil)) | |
527 | 544 |
528 ;;;###autoload | 545 ;;;###autoload |
529 (defvar ispell-menu-xemacs nil | 546 (defvar ispell-menu-xemacs nil |
530 "Spelling menu for XEmacs. | 547 "Spelling menu for XEmacs. |
531 If nil when package is loaded, a standard menu will be set, | 548 If nil when package is loaded, a standard menu will be set, |
689 (defun ispell-get-ispell-args () | 706 (defun ispell-get-ispell-args () |
690 (nth 5 (assoc ispell-dictionary ispell-dictionary-alist))) | 707 (nth 5 (assoc ispell-dictionary ispell-dictionary-alist))) |
691 (defun ispell-get-extended-character-mode () | 708 (defun ispell-get-extended-character-mode () |
692 (nth 6 (assoc ispell-dictionary ispell-dictionary-alist))) | 709 (nth 6 (assoc ispell-dictionary ispell-dictionary-alist))) |
693 (defun ispell-get-coding-system () | 710 (defun ispell-get-coding-system () |
694 (or (nth 7 (assoc ispell-dictionary ispell-dictionary-alist)) | 711 (nth 7 (assoc ispell-dictionary ispell-dictionary-alist))) |
695 ;; We default to Latin-1 because otherwise multibyte | |
696 ;; characters cause synchronization confusion | |
697 ;; with the Ispell process. | |
698 'iso-latin-1)) | |
699 | 712 |
700 (defvar ispell-process nil | 713 (defvar ispell-process nil |
701 "The process object for Ispell.") | 714 "The process object for Ispell.") |
702 | 715 |
703 (defvar ispell-pdict-modified-p nil | 716 (defvar ispell-pdict-modified-p nil |
722 | 735 |
723 (defvar ispell-recursive-edit-marker (make-marker) | 736 (defvar ispell-recursive-edit-marker (make-marker) |
724 "Marker for return point from recursive edit.") | 737 "Marker for return point from recursive edit.") |
725 | 738 |
726 (defvar ispell-checking-message nil | 739 (defvar ispell-checking-message nil |
727 "Non-nil when we're checking a mail message") | 740 "Non-nil when we're checking a mail message.") |
728 | 741 |
729 (defconst ispell-choices-buffer "*Choices*") | 742 (defconst ispell-choices-buffer "*Choices*") |
730 | 743 |
731 (defvar ispell-overlay nil "Overlay variable for Ispell highlighting.") | 744 (defvar ispell-overlay nil "Overlay variable for Ispell highlighting.") |
732 | 745 |
817 (defcustom ispell-skip-sgml 'use-mode-name | 830 (defcustom ispell-skip-sgml 'use-mode-name |
818 "*Indicates whether ispell should skip spell checking of SGML markup. | 831 "*Indicates whether ispell should skip spell checking of SGML markup. |
819 If t, always skip SGML markup; if nil, never skip; if non-t and non-nil, | 832 If t, always skip SGML markup; if nil, never skip; if non-t and non-nil, |
820 guess whether SGML markup should be skipped according to the name of the | 833 guess whether SGML markup should be skipped according to the name of the |
821 buffer's major mode." | 834 buffer's major mode." |
822 :type '(choice (const t) (const nil) | 835 :type '(choice (const :tag "always" t) (const :tag "never" nil) |
823 (other :tag "use-mode-name" use-mode-name)) | 836 (const :tag "use-mode-name" use-mode-name)) |
824 :group 'ispell) | 837 :group 'ispell) |
825 | 838 |
826 (defvar ispell-local-pdict ispell-personal-dictionary | 839 (defvar ispell-local-pdict ispell-personal-dictionary |
827 "A buffer local variable containing the current personal dictionary. | 840 "A buffer local variable containing the current personal dictionary. |
828 If non-nil, the value must be a string, which is a file name. | 841 If non-nil, the value must be a string, which is a file name. |
839 "Contains the buffer name if local word definitions were used. | 852 "Contains the buffer name if local word definitions were used. |
840 Ispell is then restarted because the local words could conflict.") | 853 Ispell is then restarted because the local words could conflict.") |
841 | 854 |
842 (defvar ispell-parser 'use-mode-name | 855 (defvar ispell-parser 'use-mode-name |
843 "*Indicates whether ispell should parse the current buffer as TeX Code. | 856 "*Indicates whether ispell should parse the current buffer as TeX Code. |
844 Special value `use-mode-name' tries to guess using the name of major-mode. | 857 Special value `use-mode-name' tries to guess using the name of `major-mode'. |
845 Default parser is `nroff'. | 858 Default parser is `nroff'. |
846 Currently the only other valid parser is `tex'. | 859 Currently the only other valid parser is `tex'. |
847 | 860 |
848 You can set this variable in hooks in your init file -- eg: | 861 You can set this variable in hooks in your init file -- eg: |
849 | 862 |
861 | 874 |
862 | 875 |
863 | 876 |
864 (and (not (string-match "18\\.[0-9]+\\.[0-9]+" emacs-version)) | 877 (and (not (string-match "18\\.[0-9]+\\.[0-9]+" emacs-version)) |
865 (not (boundp 'epoch::version)) | 878 (not (boundp 'epoch::version)) |
866 (defalias 'ispell 'ispell-buffer)) | 879 (defalias 'ispell 'ispell-buffer) |
880 (defalias 'ispell-check-version 'check-ispell-version)) | |
881 | |
867 | 882 |
868 (if (not (fboundp 'buffer-substring-no-properties)) | 883 (if (not (fboundp 'buffer-substring-no-properties)) |
869 (defun buffer-substring-no-properties (start end) | 884 (defun buffer-substring-no-properties (start end) |
870 (buffer-substring start end))) | 885 (buffer-substring start end))) |
871 | 886 |
876 (defun ispell-word (&optional following quietly continue) | 891 (defun ispell-word (&optional following quietly continue) |
877 "Check spelling of word under or before the cursor. | 892 "Check spelling of word under or before the cursor. |
878 If the word is not found in dictionary, display possible corrections | 893 If the word is not found in dictionary, display possible corrections |
879 in a window allowing you to choose one. | 894 in a window allowing you to choose one. |
880 | 895 |
881 With a prefix argument (or if CONTINUE is non-nil), | |
882 resume interrupted spell-checking of a buffer or region. | |
883 | |
884 If optional argument FOLLOWING is non-nil or if `ispell-following-word' | 896 If optional argument FOLLOWING is non-nil or if `ispell-following-word' |
885 is non-nil when called interactively, then the following word | 897 is non-nil when called interactively, then the following word |
886 \(rather than preceding\) is checked when the cursor is not over a word. | 898 \(rather than preceding\) is checked when the cursor is not over a word. |
887 When the optional argument QUIETLY is non-nil or `ispell-quietly' is non-nil | 899 When the optional argument QUIETLY is non-nil or `ispell-quietly' is non-nil |
888 when called interactively, non-corrective messages are suppressed. | 900 when called interactively, non-corrective messages are suppressed. |
901 | |
902 With a prefix argument (or if CONTINUE is non-nil), | |
903 resume interrupted spell-checking of a buffer or region. | |
889 | 904 |
890 Word syntax described by `ispell-dictionary-alist' (which see). | 905 Word syntax described by `ispell-dictionary-alist' (which see). |
891 | 906 |
892 This will check or reload the dictionary. Use \\[ispell-change-dictionary] | 907 This will check or reload the dictionary. Use \\[ispell-change-dictionary] |
893 or \\[ispell-region] to update the Ispell process." | 908 or \\[ispell-region] to update the Ispell process." |
1456 (sit-for 5) | 1471 (sit-for 5) |
1457 (erase-buffer)))))) | 1472 (erase-buffer)))))) |
1458 | 1473 |
1459 | 1474 |
1460 (defun lookup-words (word &optional lookup-dict) | 1475 (defun lookup-words (word &optional lookup-dict) |
1461 "Look up word in word-list dictionary. | 1476 "Look up WORD in optional word-list dictionary LOOKUP-DICT. |
1462 A `*' serves as a wild card. If no wild cards, `look' is used if it exists. | 1477 A `*' serves as a wild card. If no wild cards, `look' is used if it exists. |
1463 Otherwise the variable `ispell-grep-command' contains the command used to | 1478 Otherwise the variable `ispell-grep-command' contains the command used to |
1464 search for the words (usually egrep). | 1479 search for the words (usually egrep). |
1465 | 1480 |
1466 Optional second argument contains the dictionary to use; the default is | 1481 Optional second argument contains the dictionary to use; the default is |
1668 ((string= output "") t) ; for startup with pipes... | 1683 ((string= output "") t) ; for startup with pipes... |
1669 ((string= output "*") t) ; exact match | 1684 ((string= output "*") t) ; exact match |
1670 ((string= output "-") t) ; compound word match | 1685 ((string= output "-") t) ; compound word match |
1671 ((string= (substring output 0 1) "+") ; found because of root word | 1686 ((string= (substring output 0 1) "+") ; found because of root word |
1672 (substring output 2)) ; return root word | 1687 (substring output 2)) ; return root word |
1673 ((equal 0 (string-match "[\ | 1688 ((equal 0 (string-match "[\ra-zA-Z]" output)) |
1674 a-zA-Z]" output)) | |
1675 (ding) ; error message from ispell! | 1689 (ding) ; error message from ispell! |
1676 (message (concat "Ispell error: " output)) | 1690 (message (concat "Ispell error: " output)) |
1677 (sit-for 5) | 1691 (sit-for 5) |
1678 nil) | 1692 nil) |
1679 (t ; need to process &, ?, and #'s | 1693 (t ; need to process &, ?, and #'s |
1697 (setq guess-list (cons (substring output 0 end) guess-list)) | 1711 (setq guess-list (cons (substring output 0 end) guess-list)) |
1698 (setq miss-list (cons (substring output 0 end) miss-list))) | 1712 (setq miss-list (cons (substring output 0 end) miss-list))) |
1699 (if (match-end 1) ; True only when at end of line. | 1713 (if (match-end 1) ; True only when at end of line. |
1700 (setq output nil) ; no more misses or guesses | 1714 (setq output nil) ; no more misses or guesses |
1701 (setq output (substring output (+ end 2)))))) | 1715 (setq output (substring output (+ end 2)))))) |
1702 (list original-word offset miss-list guess-list))))) | 1716 (list original-word offset (nreverse miss-list)(nreverse guess-list)))))) |
1703 | 1717 |
1704 | 1718 |
1705 (defun check-ispell-version (&optional interactivep) | 1719 (defun check-ispell-version (&optional interactivep) |
1706 ;; This is a little wasteful as we actually launch ispell twice: once | 1720 ;; This is a little wasteful as we actually launch ispell twice: once |
1707 ;; to make sure it's the right version, and once for real. But people | 1721 ;; to make sure it's the right version, and once for real. But people |
1710 ;; option is the only way I can think of to do this that works with | 1724 ;; option is the only way I can think of to do this that works with |
1711 ;; all versions, since versions earlier than 3.0.09 didn't identify | 1725 ;; all versions, since versions earlier than 3.0.09 didn't identify |
1712 ;; themselves on startup. | 1726 ;; themselves on startup. |
1713 (interactive "p") | 1727 (interactive "p") |
1714 (let ((result t) | 1728 (let ((result t) |
1715 case-fold-search status) | 1729 (case-fold-search-val case-fold-search) |
1730 ;; avoid bugs when syntax of `.' changes in various default modes | |
1731 (default-major-mode 'fundamental-mode) | |
1732 status) | |
1716 (save-excursion | 1733 (save-excursion |
1717 (set-buffer (get-buffer-create " *ispell-tmp*")) | 1734 (set-buffer (get-buffer-create " *ispell-tmp*")) |
1718 (setq case-fold-search t) | |
1719 (erase-buffer) | 1735 (erase-buffer) |
1720 (setq status (call-process ispell-program-name nil t nil "-v")) | 1736 (setq status (call-process ispell-program-name nil t nil "-v")) |
1721 (goto-char (point-min)) | 1737 (goto-char (point-min)) |
1722 (if interactivep | 1738 (if interactivep |
1723 (progn | 1739 (progn |
1729 (message result) | 1745 (message result) |
1730 (goto-char (point-min)))) | 1746 (goto-char (point-min)))) |
1731 (if (not (memq status '(0 nil))) | 1747 (if (not (memq status '(0 nil))) |
1732 (error "%s exited with %s %s" ispell-program-name | 1748 (error "%s exited with %s %s" ispell-program-name |
1733 (if (stringp status) "signal" "code") status)) | 1749 (if (stringp status) "signal" "code") status)) |
1734 (if (not (re-search-forward | 1750 (setq case-fold-search t |
1735 (concat "\\<\\(" | 1751 status (re-search-forward |
1736 (regexp-quote (car ispell-required-version)) | 1752 (concat "\\<\\(" |
1737 "\\)\\([0-9]*\\)\\>") | 1753 (regexp-quote (car ispell-required-version)) |
1738 nil t)) | 1754 "\\)\\([0-9]*\\)\\>") |
1755 nil t) | |
1756 case-fold-search case-fold-search-val) | |
1757 (if (not status) | |
1739 (error "%s version 3 release %s%s or greater is required" | 1758 (error "%s version 3 release %s%s or greater is required" |
1740 ispell-program-name (car ispell-required-version) | 1759 ispell-program-name (car ispell-required-version) |
1741 (car (cdr ispell-required-version))) | 1760 (car (cdr ispell-required-version))) |
1742 ;; check that it is the correct version. | 1761 ;; check that it is the correct version. |
1743 (if (< (car (read-from-string (buffer-substring-no-properties | 1762 (if (< (car (read-from-string (buffer-substring-no-properties |
1744 (match-beginning 2) (match-end 2)))) | 1763 (match-beginning 2) (match-end 2)))) |
1745 (car (cdr ispell-required-version))) | 1764 (car (cdr ispell-required-version))) |
1746 (setq ispell-offset 0))) | 1765 (setq ispell-offset 0))) |
1747 (kill-buffer (current-buffer)) | 1766 (kill-buffer (current-buffer))) |
1748 result))) | 1767 result)) |
1749 | 1768 |
1750 | 1769 |
1751 (defun ispell-init-process () | 1770 (defun ispell-init-process () |
1752 "Check status of Ispell process and start if necessary." | 1771 "Check status of Ispell process and start if necessary." |
1753 (if (and ispell-process | 1772 (if (and ispell-process |
1789 ispell-process-directory default-directory) | 1808 ispell-process-directory default-directory) |
1790 (set-process-filter ispell-process 'ispell-filter) | 1809 (set-process-filter ispell-process 'ispell-filter) |
1791 (if (and (boundp 'enable-multibyte-characters) | 1810 (if (and (boundp 'enable-multibyte-characters) |
1792 (fboundp 'set-process-coding-system) | 1811 (fboundp 'set-process-coding-system) |
1793 enable-multibyte-characters) | 1812 enable-multibyte-characters) |
1794 (set-process-coding-system ispell-process (ispell-get-coding-system))) | 1813 (set-process-coding-system ispell-process (ispell-get-coding-system) |
1814 (ispell-get-coding-system))) | |
1795 ;; Get version ID line | 1815 ;; Get version ID line |
1796 (if (not (string-match "18\\.[0-9]+\\.[0-9]+" emacs-version)) | 1816 (if (not (string-match "18\\.[0-9]+\\.[0-9]+" emacs-version)) |
1797 (accept-process-output ispell-process 5) | 1817 (accept-process-output ispell-process 3) |
1798 (accept-process-output ispell-process)) | 1818 (accept-process-output ispell-process)) |
1799 ;; get more output if filter empty? | 1819 ;; get more output if filter empty? |
1800 (if (null ispell-filter) (accept-process-output ispell-process 5)) | 1820 (if (null ispell-filter) (accept-process-output ispell-process 3)) |
1801 (cond ((null ispell-filter) | 1821 (cond ((null ispell-filter) |
1802 (error "%s did not output version line" ispell-program-name)) | 1822 (error "%s did not output version line" ispell-program-name)) |
1803 ((and | 1823 ((and |
1804 (stringp (car ispell-filter)) | 1824 (stringp (car ispell-filter)) |
1805 (if (string-match "warning: " (car ispell-filter)) | 1825 (if (string-match "warning: " (car ispell-filter)) |
1806 (progn | 1826 (progn |
1807 (if (not (string-match "18\\.[0-9]+\\.[0-9]+" emacs-version)) | 1827 (if (not (string-match "18\\.[0-9]+\\.[0-9]+" emacs-version)) |
1808 (accept-process-output ispell-process 5) ; was warn msg. | 1828 (accept-process-output ispell-process 3) ; was warn msg. |
1809 (accept-process-output ispell-process)) | 1829 (accept-process-output ispell-process)) |
1810 (stringp (car ispell-filter))) | 1830 (stringp (car ispell-filter))) |
1811 (null (cdr ispell-filter))) | 1831 (null (cdr ispell-filter))) |
1812 (string-match "^@(#) " (car ispell-filter))) | 1832 (string-match "^@(#) " (car ispell-filter))) |
1813 ;; got the version line as expected (we already know it's the right | 1833 ;; got the version line as expected (we already know it's the right |
1816 (t | 1836 (t |
1817 ;; Otherwise, it must be an error message. Show the user. | 1837 ;; Otherwise, it must be an error message. Show the user. |
1818 ;; But first wait to see if some more output is going to arrive. | 1838 ;; But first wait to see if some more output is going to arrive. |
1819 ;; Otherwise we get cool errors like "Can't open ". | 1839 ;; Otherwise we get cool errors like "Can't open ". |
1820 (sleep-for 1) | 1840 (sleep-for 1) |
1821 (accept-process-output) | 1841 (accept-process-output ispell-process 3) |
1822 (error "%s" (mapconcat 'identity ispell-filter "\n")))) | 1842 (error "%s" (mapconcat 'identity ispell-filter "\n")))) |
1823 (setq ispell-filter nil) ; Discard version ID line | 1843 (setq ispell-filter nil) ; Discard version ID line |
1824 (let ((extended-char-mode (ispell-get-extended-character-mode))) | 1844 (let ((extended-char-mode (ispell-get-extended-character-mode))) |
1825 (if extended-char-mode | 1845 (if extended-char-mode |
1826 (process-send-string ispell-process | 1846 (process-send-string ispell-process |
1834 (interactive) | 1854 (interactive) |
1835 (if (not (and ispell-process | 1855 (if (not (and ispell-process |
1836 (eq (process-status ispell-process) 'run))) | 1856 (eq (process-status ispell-process) 'run))) |
1837 (or no-error | 1857 (or no-error |
1838 (error "There is no ispell process running!")) | 1858 (error "There is no ispell process running!")) |
1839 (kill-process ispell-process) | 1859 (process-send-eof ispell-process) |
1860 (process-send-string ispell-process "\n") ; make sure side effects occured | |
1861 (if (eq (process-status ispell-process) 'run) | |
1862 (accept-process-output ispell-process 1)) | |
1863 (if (eq (process-status ispell-process) 'run) | |
1864 (kill-process ispell-process)) | |
1865 (while (not (or (eq (process-status ispell-process) 'exit) | |
1866 (eq (process-status ispell-process) 'signal))) | |
1867 (sleep-for 0 250)) | |
1840 (setq ispell-process nil) | 1868 (setq ispell-process nil) |
1841 (message "Ispell process killed") | 1869 (message "Ispell process killed") |
1842 nil)) | 1870 nil)) |
1843 | 1871 |
1844 | 1872 |
1845 ;;; ispell-change-dictionary is set in some people's hooks. Maybe this should | 1873 ;;; ispell-change-dictionary is set in some people's hooks. Maybe this should |
1846 ;;; call ispell-init-process rather than wait for a spell checking command? | 1874 ;;; call ispell-init-process rather than wait for a spell checking command? |
1847 | 1875 |
1848 ;;;###autoload | 1876 ;;;###autoload |
1849 (defun ispell-change-dictionary (dict &optional arg) | 1877 (defun ispell-change-dictionary (dict &optional arg) |
1850 "Change `ispell-dictionary' (q.v.) and kill old Ispell process. | 1878 "Change `ispell-dictionary' (q.v.) to DICT and kill old Ispell process. |
1851 A new one will be started as soon as necessary. | 1879 A new one will be started as soon as necessary. |
1852 | 1880 |
1853 By just answering RET you can find out what the current dictionary is. | 1881 By just answering RET you can find out what the current dictionary is. |
1854 | 1882 |
1855 With prefix argument, set the default directory." | 1883 With prefix argument, set the default directory." |
1893 ;;; Spelling of comments are checked when ispell-check-comments is non-nil. | 1921 ;;; Spelling of comments are checked when ispell-check-comments is non-nil. |
1894 | 1922 |
1895 ;;;###autoload | 1923 ;;;###autoload |
1896 (defun ispell-region (reg-start reg-end) | 1924 (defun ispell-region (reg-start reg-end) |
1897 "Interactively check a region for spelling errors. | 1925 "Interactively check a region for spelling errors. |
1898 Return non-nil if not aborted." | 1926 Return non-nil if spell session completed normally." |
1899 (interactive "r") ; Don't flag errors on read-only bufs. | 1927 (interactive "r") ; Don't flag errors on read-only bufs. |
1900 (ispell-accept-buffer-local-defs) ; set up dictionary, local words, etc. | 1928 (ispell-accept-buffer-local-defs) ; set up dictionary, local words, etc. |
1901 (unwind-protect | 1929 (unwind-protect |
1902 (save-excursion | 1930 (save-excursion |
1903 (message "Spell checking %s using %s dictionary..." | 1931 (message "Spell checking %s using %s dictionary..." |
1958 (string (ispell-get-line start end reg-end))) | 1986 (string (ispell-get-line start end reg-end))) |
1959 (setq end (point)) ; "end" tracks region retrieved. | 1987 (setq end (point)) ; "end" tracks region retrieved. |
1960 (if string ; there is something to spell check! | 1988 (if string ; there is something to spell check! |
1961 (ispell-process-line string)) ; (special start end) | 1989 (ispell-process-line string)) ; (special start end) |
1962 (goto-char end))))) | 1990 (goto-char end))))) |
1963 (not ispell-quit) | 1991 (not ispell-quit)) |
1964 ) | |
1965 ;; protected | 1992 ;; protected |
1966 (if (get-buffer ispell-choices-buffer) | 1993 (if (get-buffer ispell-choices-buffer) |
1967 (kill-buffer ispell-choices-buffer)) | 1994 (kill-buffer ispell-choices-buffer)) |
1968 (if ispell-quit | 1995 (if ispell-quit |
1969 (progn | 1996 (progn |
1974 (goto-char ispell-quit)) | 2001 (goto-char ispell-quit)) |
1975 ;; Check for aborting | 2002 ;; Check for aborting |
1976 (if (and ispell-checking-message (numberp ispell-quit)) | 2003 (if (and ispell-checking-message (numberp ispell-quit)) |
1977 (progn | 2004 (progn |
1978 (setq ispell-quit nil) | 2005 (setq ispell-quit nil) |
1979 (error "Message send aborted."))) | 2006 (error "Message send aborted"))) |
1980 (setq ispell-quit nil)) | 2007 (setq ispell-quit nil)) |
1981 (set-marker ispell-region-end nil) | 2008 (set-marker ispell-region-end nil) |
1982 ;; Only save if successful exit. | 2009 ;; Only save if successful exit. |
1983 (ispell-pdict-save ispell-silently-savep) | 2010 (ispell-pdict-save ispell-silently-savep) |
1984 (message "Spell-checking done")))) | 2011 (message "Spell-checking done")))) |
1998 (regexp-quote comment-end)) | 2025 (regexp-quote comment-end)) |
1999 "\\|" skip-regexp))) | 2026 "\\|" skip-regexp))) |
2000 (if ispell-skip-tib | 2027 (if ispell-skip-tib |
2001 (setq skip-regexp (concat ispell-tib-ref-beginning "\\|" skip-regexp))) | 2028 (setq skip-regexp (concat ispell-tib-ref-beginning "\\|" skip-regexp))) |
2002 (if ispell-skip-sgml | 2029 (if ispell-skip-sgml |
2003 (setq skip-regexp (concat "[<&]\\|" skip-regexp))) | 2030 (setq skip-regexp (concat "<author>" "\\|" |
2031 "<[cC][oO][dD][eE]>" "\\|" | |
2032 "<[vV][eE][rR][bB]>" "\\|" | |
2033 "<[tT][tT]>" "\\|" | |
2034 "<[tT][tT]/" "\\|" | |
2035 "</" "\\|" | |
2036 "<" "\\|" | |
2037 "&" "\\|" | |
2038 skip-regexp))) | |
2004 (if (eq ispell-parser 'tex) | 2039 (if (eq ispell-parser 'tex) |
2005 (setq skip-regexp (concat (ispell-begin-tex-skip-regexp) "\\|" | 2040 (setq skip-regexp (concat (ispell-begin-tex-skip-regexp) "\\|" |
2006 skip-regexp))) | 2041 skip-regexp))) |
2007 skip-regexp)) | 2042 skip-regexp)) |
2008 | 2043 |
2009 | 2044 |
2010 ;;; Regular expression of tex commands to skip. | |
2011 ;;; Generated from `ispell-tex-skip-alists' | |
2012 (defun ispell-begin-tex-skip-regexp () | 2045 (defun ispell-begin-tex-skip-regexp () |
2046 "Regular expression of tex commands to skip. | |
2047 Generated from `ispell-tex-skip-alists'." | |
2013 (concat | 2048 (concat |
2014 (mapconcat (function (lambda (lst) (car lst))) | 2049 (mapconcat (function (lambda (lst) (car lst))) |
2015 (car ispell-tex-skip-alists) | 2050 (car ispell-tex-skip-alists) |
2016 "\\|") | 2051 "\\|") |
2017 "\\|" | 2052 "\\|" |
2021 "[ \t\n]*}"))) | 2056 "[ \t\n]*}"))) |
2022 (car (cdr ispell-tex-skip-alists)) | 2057 (car (cdr ispell-tex-skip-alists)) |
2023 "\\|"))) | 2058 "\\|"))) |
2024 | 2059 |
2025 | 2060 |
2026 ;;; Regular expression of regions to skip for all buffers. | |
2027 ;;; Each selection should be a key of `ispell-skip-region-alist' | |
2028 ;;; otherwise, the current line is skipped. | |
2029 (defun ispell-begin-skip-region () | 2061 (defun ispell-begin-skip-region () |
2062 "Regular expression of regions to skip for all buffers. | |
2063 Each selection should be a key of `ispell-skip-region-alist'; | |
2064 otherwise, the current line is skipped." | |
2030 (mapconcat (function (lambda (lst) (if (stringp (car lst)) (car lst) | 2065 (mapconcat (function (lambda (lst) (if (stringp (car lst)) (car lst) |
2031 (eval (car lst))))) | 2066 (eval (car lst))))) |
2032 ispell-skip-region-alist | 2067 ispell-skip-region-alist |
2033 "\\|")) | 2068 "\\|")) |
2034 | 2069 |
2061 ((and (eq 'exclusive ispell-check-comments) comment-start | 2096 ((and (eq 'exclusive ispell-check-comments) comment-start |
2062 (string= key comment-end)) | 2097 (string= key comment-end)) |
2063 (search-forward comment-start ispell-region-end :end)) | 2098 (search-forward comment-start ispell-region-end :end)) |
2064 ((and ispell-skip-tib (string-match ispell-tib-ref-beginning key)) | 2099 ((and ispell-skip-tib (string-match ispell-tib-ref-beginning key)) |
2065 (re-search-forward ispell-tib-ref-end ispell-region-end t)) | 2100 (re-search-forward ispell-tib-ref-end ispell-region-end t)) |
2101 ((and ispell-skip-sgml (string-match "<author>" key)) | |
2102 (search-forward-regexp ".$" ispell-region-end t)) | |
2103 ((and ispell-skip-sgml (string-match "</" key)) | |
2104 (search-forward ">" ispell-region-end t)) | |
2105 ((and ispell-skip-sgml (string-match "<[cC][oO][dD][eE]>" key)) | |
2106 (search-forward-regexp "</[cC][oO][dD][eE]>" ispell-region-end t)) | |
2107 ((and ispell-skip-sgml (string-match "<[vV][eE][rR][bB]>" key)) | |
2108 (search-forward-regexp "</[vV][eE][rR][bB]>" ispell-region-end t)) | |
2109 ((and ispell-skip-sgml (string-match "<[tT][tT]>" key)) | |
2110 (search-forward-regexp "</[tT][tT]>" ispell-region-end t)) | |
2111 ((and ispell-skip-sgml (string-match "<[tT][tT]/" key)) | |
2112 (search-forward "/" ispell-region-end t)) | |
2066 ((and ispell-skip-sgml (string-match "<" key)) | 2113 ((and ispell-skip-sgml (string-match "<" key)) |
2067 (search-forward ">" ispell-region-end t)) | 2114 (search-forward-regexp "[/>]" ispell-region-end t)) |
2068 ((and ispell-skip-sgml (string-match "&" key)) | 2115 ((and ispell-skip-sgml (string-match "&" key)) |
2069 (search-forward ";" ispell-region-end t)) | 2116 (search-forward ";" ispell-region-end t)) |
2070 ;; markings from alist | 2117 ;; markings from alist |
2071 (t | 2118 (t |
2072 (while alist | 2119 (while alist |
2256 (when (or (nth 3 state) (nth 4 state)) | 2303 (when (or (nth 3 state) (nth 4 state)) |
2257 (let ((start (point))) | 2304 (let ((start (point))) |
2258 (setq state (parse-partial-sexp start (point-max) | 2305 (setq state (parse-partial-sexp start (point-max) |
2259 nil nil state 'syntax-table)) | 2306 nil nil state 'syntax-table)) |
2260 (when (or (nth 3 state) (nth 4 state)) | 2307 (when (or (nth 3 state) (nth 4 state)) |
2261 (error "Unterminated string or comment.")) | 2308 (error "Unterminated string or comment")) |
2262 (save-excursion | 2309 (save-excursion |
2263 (setq done (not (ispell-region start (point)))))))))) | 2310 (setq done (not (ispell-region start (point)))))))))) |
2264 | 2311 |
2265 | 2312 |
2266 ;;;###autoload | 2313 ;;;###autoload |
2270 (ispell-region (point-min) (point-max))) | 2317 (ispell-region (point-min) (point-max))) |
2271 | 2318 |
2272 | 2319 |
2273 ;;;###autoload | 2320 ;;;###autoload |
2274 (defun ispell-continue () | 2321 (defun ispell-continue () |
2322 "Continue a halted spelling session beginning with the current word." | |
2275 (interactive) | 2323 (interactive) |
2276 "Continue a halted spelling session beginning with the current word." | |
2277 (if (not (marker-position ispell-region-end)) | 2324 (if (not (marker-position ispell-region-end)) |
2278 (message "No session to continue. Use 'X' command when checking!") | 2325 (message "No session to continue. Use 'X' command when checking!") |
2279 (if (not (equal (marker-buffer ispell-region-end) (current-buffer))) | 2326 (if (not (equal (marker-buffer ispell-region-end) (current-buffer))) |
2280 (message "Must continue ispell from buffer %s" | 2327 (message "Must continue ispell from buffer %s" |
2281 (buffer-name (marker-buffer ispell-region-end))) | 2328 (buffer-name (marker-buffer ispell-region-end))) |
2300 ;;; Interactive word completion. | 2347 ;;; Interactive word completion. |
2301 ;;; Forces "previous-word" processing. Do we want to make this selectable? | 2348 ;;; Forces "previous-word" processing. Do we want to make this selectable? |
2302 | 2349 |
2303 ;;;###autoload | 2350 ;;;###autoload |
2304 (defun ispell-complete-word (&optional interior-frag) | 2351 (defun ispell-complete-word (&optional interior-frag) |
2305 "Look up word before or under point in dictionary (see lookup-words command) | 2352 "Try to complete the word before or under point (see `lookup-words') |
2306 and try to complete it. If optional INTERIOR-FRAG is non-nil then the word | 2353 If optional INTERIOR-FRAG is non-nil then the word may be a character |
2307 may be a character sequence inside of a word. | 2354 sequence inside of a word. |
2308 | 2355 |
2309 Standard ispell choices are then available." | 2356 Standard ispell choices are then available." |
2310 (interactive "P") | 2357 (interactive "P") |
2311 (let ((cursor-location (point)) | 2358 (let ((cursor-location (point)) |
2312 case-fold-search | 2359 (case-fold-search-val case-fold-search) |
2313 (word (ispell-get-word nil "\\*")) ; force "previous-word" processing. | 2360 (word (ispell-get-word nil "\\*")) ; force "previous-word" processing. |
2314 start end possibilities replacement) | 2361 start end possibilities replacement) |
2315 (setq start (car (cdr word)) | 2362 (setq start (car (cdr word)) |
2316 end (car (cdr (cdr word))) | 2363 end (car (cdr (cdr word))) |
2317 word (car word) | 2364 word (car word) |
2324 (cond ((eq possibilities t) | 2371 (cond ((eq possibilities t) |
2325 (message "No word to complete")) | 2372 (message "No word to complete")) |
2326 ((null possibilities) | 2373 ((null possibilities) |
2327 (message "No match for \"%s\"" word)) | 2374 (message "No match for \"%s\"" word)) |
2328 (t ; There is a modification... | 2375 (t ; There is a modification... |
2329 (cond ; Try and respect case of word. | 2376 (setq case-fold-search nil) ; Try and respect case of word. |
2330 ((string-match "^[^A-Z]+$" word) | 2377 (cond |
2331 (setq possibilities (mapcar 'downcase possibilities))) | 2378 ((string-equal (upcase word) word) |
2332 ((string-match "^[^a-z]+$" word) | |
2333 (setq possibilities (mapcar 'upcase possibilities))) | 2379 (setq possibilities (mapcar 'upcase possibilities))) |
2334 ((string-match "^[A-Z]" word) | 2380 ((string-equal (upcase (substring word 0 1)) (substring word 0 1)) |
2335 (setq possibilities (mapcar 'capitalize possibilities)))) | 2381 (setq possibilities (mapcar (function |
2382 (lambda (pos) | |
2383 (if (string-equal | |
2384 (substring word 0 1) | |
2385 (substring pos 0 1)) | |
2386 pos | |
2387 (capitalize pos)))) | |
2388 possibilities)))) | |
2389 (setq case-fold-search case-fold-search-val) | |
2336 (save-window-excursion | 2390 (save-window-excursion |
2337 (setq replacement | 2391 (setq replacement |
2338 (ispell-command-loop possibilities nil word start end))) | 2392 (ispell-command-loop possibilities nil word start end))) |
2339 (cond | 2393 (cond |
2340 ((equal 0 replacement) ; BUFFER-LOCAL ADDITION | 2394 ((equal 0 replacement) ; BUFFER-LOCAL ADDITION |
2410 Don't read buffer-local settings or word lists." | 2464 Don't read buffer-local settings or word lists." |
2411 (interactive "*") | 2465 (interactive "*") |
2412 (let ((ispell-minor-mode nil) | 2466 (let ((ispell-minor-mode nil) |
2413 (ispell-check-only t) | 2467 (ispell-check-only t) |
2414 (last-char (char-after (1- (point))))) | 2468 (last-char (char-after (1- (point))))) |
2415 (if (or (eq last-char ?\ ) (eq last-char ?\n)) | 2469 (if (or (eq last-char ?\ ) (eq last-char ?\n) |
2470 (and ispell-skip-sgml (eq last-char ?>)) | |
2471 (and ispell-skip-sgml (eq last-char ?\;))) | |
2416 nil | 2472 nil |
2417 (save-window-excursion | 2473 (save-window-excursion |
2418 (save-restriction | 2474 (save-restriction |
2419 (narrow-to-region (save-excursion (forward-line -1) (point)) (point)) | 2475 (narrow-to-region (save-excursion (forward-line -1) (point)) (point)) |
2420 (ispell-word nil t)))) | 2476 (ispell-word nil t)))) |
2421 (call-interactively (key-binding (this-command-keys))))) | 2477 (command-execute (key-binding (this-command-keys))))) |
2422 | 2478 |
2423 | 2479 |
2424 ;;; ********************************************************************** | 2480 ;;; ********************************************************************** |
2425 ;;; Ispell Message | 2481 ;;; Ispell Message |
2426 ;;; ********************************************************************** | 2482 ;;; ********************************************************************** |
2445 ;; Matches reporter.el bug report | 2501 ;; Matches reporter.el bug report |
2446 "^current state:\n==============\n" | 2502 "^current state:\n==============\n" |
2447 ;; Matches commonly used "cut" boundaries | 2503 ;; Matches commonly used "cut" boundaries |
2448 "^\\(- \\)?[-=_]+\\s ?\\(cut here\\|Environment Follows\\)") | 2504 "^\\(- \\)?[-=_]+\\s ?\\(cut here\\|Environment Follows\\)") |
2449 "\\|") | 2505 "\\|") |
2450 "*End of text which will be checked in ispell-message. | 2506 "*End of text which will be checked in `ispell-message'. |
2451 If it is a string, limit at first occurrence of that regular expression. | 2507 If it is a string, limit at first occurrence of that regular expression. |
2452 Otherwise, it must be a function which is called to get the limit.") | 2508 Otherwise, it must be a function which is called to get the limit.") |
2453 | 2509 |
2454 | 2510 |
2455 | 2511 |
2508 (concat "\\(" sc-cite-regexp "\\)" "\\|" | 2564 (concat "\\(" sc-cite-regexp "\\)" "\\|" |
2509 (ispell-non-empty-string sc-reference-tag-string))) | 2565 (ispell-non-empty-string sc-reference-tag-string))) |
2510 ((or (equal major-mode 'news-reply-mode) ;GNUS 4 & below | 2566 ((or (equal major-mode 'news-reply-mode) ;GNUS 4 & below |
2511 (equal major-mode 'message-mode)) ;GNUS 5 | 2567 (equal major-mode 'message-mode)) ;GNUS 5 |
2512 (concat "In article <" "\\|" | 2568 (concat "In article <" "\\|" |
2513 "[^,;&+=]+ <[^,;&+=]+> writes:" "\\|" | 2569 "[^,;&+=\n]+ <[^,;&+=]+> writes:" "\\|" |
2570 message-yank-prefix "\\|" | |
2514 default-prefix)) | 2571 default-prefix)) |
2515 ((equal major-mode 'mh-letter-mode) ; mh mail message | 2572 ((equal major-mode 'mh-letter-mode) ; mh mail message |
2516 (ispell-non-empty-string mh-ins-buf-prefix)) | 2573 (concat "[^,;&+=\n]+ writes:" "\\|" |
2574 (ispell-non-empty-string mh-ins-buf-prefix))) | |
2517 ((not internal-messagep) ; Assume nn sent us this message. | 2575 ((not internal-messagep) ; Assume nn sent us this message. |
2518 (concat "In [a-zA-Z.]+ you write:" "\\|" | 2576 (concat "In [a-zA-Z.]+ you write:" "\\|" |
2519 "In <[^,;&+=]+> [^,;&+=]+ writes:" "\\|" | 2577 "In <[^,;&+=]+> [^,;&+=]+ writes:" "\\|" |
2520 " *> *")) | 2578 " *> *")) |
2521 ((boundp 'vm-included-text-prefix) ; VM mail message | 2579 ((boundp 'vm-included-text-prefix) ; VM mail message |
2522 (concat "[^,;&+=]+ writes:" "\\|" | 2580 (concat "[^,;&+=\n]+ writes:" "\\|" |
2523 (ispell-non-empty-string vm-included-text-prefix))) | 2581 (ispell-non-empty-string vm-included-text-prefix))) |
2524 (t default-prefix))) | 2582 (t default-prefix))) |
2525 (ispell-skip-region-alist | 2583 (ispell-skip-region-alist |
2526 (cons (list (concat "^\\(" cite-regexp "\\)") | 2584 (cons (list (concat "^\\(" cite-regexp "\\)") |
2527 (function forward-line)) | 2585 (function forward-line)) |
2528 ispell-skip-region-alist)) | 2586 ispell-skip-region-alist)) |
2529 (old-case-fold-search case-fold-search) | 2587 (old-case-fold-search case-fold-search) |
2530 (case-fold-search t) | |
2531 (dictionary-alist ispell-message-dictionary-alist) | 2588 (dictionary-alist ispell-message-dictionary-alist) |
2532 (ispell-checking-message t)) | 2589 (ispell-checking-message t)) |
2533 | 2590 |
2534 ;; Select dictionary for message | 2591 ;; Select dictionary for message |
2535 (or (local-variable-p 'ispell-local-dictionary (current-buffer)) | 2592 (or (local-variable-p 'ispell-local-dictionary (current-buffer)) |
2543 | 2600 |
2544 (unwind-protect | 2601 (unwind-protect |
2545 (progn | 2602 (progn |
2546 ;; Spell check any original Subject: | 2603 ;; Spell check any original Subject: |
2547 (goto-char (point-min)) | 2604 (goto-char (point-min)) |
2605 (setq case-fold-search t) | |
2548 (if (re-search-forward "^Subject: *" end-of-headers t) | 2606 (if (re-search-forward "^Subject: *" end-of-headers t) |
2549 (progn | 2607 (progn |
2550 (goto-char (match-end 0)) | 2608 (goto-char (match-end 0)) |
2551 (if (and (not (looking-at ".*Re\\>")) | 2609 (if (and (not (looking-at ".*Re\\>")) |
2552 (not (looking-at "\\["))) | 2610 (not (looking-at "\\["))) |
2553 (let ((case-fold-search old-case-fold-search)) | 2611 (progn |
2612 (setq case-fold-search old-case-fold-search) | |
2554 (ispell-region (point) | 2613 (ispell-region (point) |
2555 (progn ;Tab-initiated continuation lns. | 2614 (progn ;Tab-initiated continuation lns. |
2556 (end-of-line) | 2615 (end-of-line) |
2557 (while (looking-at "\n[ \t]") | 2616 (while (looking-at "\n[ \t]") |
2558 (end-of-line 2)) | 2617 (end-of-line 2)) |
2559 (point))))))) | 2618 (point))))))) |
2619 (setq case-fold-search old-case-fold-search) | |
2560 (goto-char end-of-headers) | 2620 (goto-char end-of-headers) |
2561 (forward-line 1) | 2621 (forward-line 1) |
2562 (ispell-region (point) limit)) | 2622 (ispell-region (point) limit)) |
2563 (set-marker end-of-headers nil) | 2623 (set-marker end-of-headers nil) |
2564 (set-marker limit nil))))) | 2624 (set-marker limit nil))))) |
2598 (set (make-local-variable 'ispell-parser) 'tex))) | 2658 (set (make-local-variable 'ispell-parser) 'tex))) |
2599 (process-send-string ispell-process "-\n")) ; set mode to normal (nroff) | 2659 (process-send-string ispell-process "-\n")) ; set mode to normal (nroff) |
2600 ;; If needed, test for SGML & HTML modes and set a buffer local nil/t value. | 2660 ;; If needed, test for SGML & HTML modes and set a buffer local nil/t value. |
2601 (if (and ispell-skip-sgml (not (eq ispell-skip-sgml t))) | 2661 (if (and ispell-skip-sgml (not (eq ispell-skip-sgml t))) |
2602 (set (make-local-variable 'ispell-skip-sgml) | 2662 (set (make-local-variable 'ispell-skip-sgml) |
2603 (not (null (let ((case-fold-search t)) | 2663 (not (null (string-match "sgml\\|html" |
2604 (string-match "sgml\\|html" | 2664 (downcase (symbol-name major-mode))))))) |
2605 (symbol-name major-mode))))))) | |
2606 ;; Set default extended character mode for given buffer, if any. | 2665 ;; Set default extended character mode for given buffer, if any. |
2607 (let ((extended-char-mode (ispell-get-extended-character-mode))) | 2666 (let ((extended-char-mode (ispell-get-extended-character-mode))) |
2608 (if extended-char-mode | 2667 (if extended-char-mode |
2609 (process-send-string ispell-process (concat extended-char-mode "\n")))) | 2668 (process-send-string ispell-process (concat extended-char-mode "\n")))) |
2610 ;; Set buffer-local parsing mode and extended character mode, if specified. | 2669 ;; Set buffer-local parsing mode and extended character mode, if specified. |
2611 (save-excursion | 2670 (save-excursion |
2612 (goto-char (point-max)) | 2671 (goto-char (point-max)) |
2613 ;; Uses last occurrence of ispell-parsing-keyword | 2672 ;; Uses last occurrence of ispell-parsing-keyword |
2614 (if (search-backward ispell-parsing-keyword nil t) | 2673 (if (search-backward ispell-parsing-keyword nil t) |
2615 (let ((end (save-excursion (end-of-line) (point))) | 2674 (let ((end (save-excursion (end-of-line) (point))) |
2616 (case-fold-search t) | |
2617 string) | 2675 string) |
2618 (search-forward ispell-parsing-keyword) | 2676 (search-forward ispell-parsing-keyword) |
2619 (while (re-search-forward " *\\([^ \"]+\\)" end t) | 2677 (while (re-search-forward " *\\([^ \"]+\\)" end t) |
2620 ;; space separated definitions. | 2678 ;; space separated definitions. |
2621 (setq string (buffer-substring-no-properties (match-beginning 1) | 2679 (setq string (downcase (buffer-substring-no-properties |
2622 (match-end 1))) | 2680 (match-beginning 1) (match-end 1)))) |
2623 (cond ((string-match "latex-mode" string) | 2681 (cond ((string-match "latex-mode" string) |
2624 (process-send-string ispell-process "+\n~tex\n")) | 2682 (process-send-string ispell-process "+\n~tex\n")) |
2625 ((string-match "nroff-mode" string) | 2683 ((string-match "nroff-mode" string) |
2626 (process-send-string ispell-process "-\n~nroff")) | 2684 (process-send-string ispell-process "-\n~nroff\n")) |
2627 ((string-match "~" string) ; Set extended character mode. | 2685 ((string-match "~" string) ; Set extended character mode. |
2628 (process-send-string ispell-process (concat string "\n"))) | 2686 (process-send-string ispell-process (concat string "\n"))) |
2629 (t (message "Invalid Ispell Parsing argument!") | 2687 (t (message "Invalid Ispell Parsing argument!") |
2630 (sit-for 2)))))))) | 2688 (sit-for 2)))))))) |
2631 | 2689 |
2703 | 2761 |
2704 | 2762 |
2705 ;;; returns optionally adjusted region-end-point. | 2763 ;;; returns optionally adjusted region-end-point. |
2706 | 2764 |
2707 (defun ispell-add-per-file-word-list (word) | 2765 (defun ispell-add-per-file-word-list (word) |
2708 "Adds new word to the per-file word list." | 2766 "Add WORD to the per-file word list." |
2709 (or ispell-buffer-local-name | 2767 (or ispell-buffer-local-name |
2710 (setq ispell-buffer-local-name (buffer-name))) | 2768 (setq ispell-buffer-local-name (buffer-name))) |
2711 (save-excursion | 2769 (save-excursion |
2712 (goto-char (point-min)) | 2770 (goto-char (point-min)) |
2713 (let (case-fold-search line-okay search done string) | 2771 (let ((old-case-fold-search case-fold-search) |
2772 line-okay search done string) | |
2714 (while (not done) | 2773 (while (not done) |
2715 (setq search (search-forward ispell-words-keyword nil 'move) | 2774 (setq case-fold-search nil |
2775 search (search-forward ispell-words-keyword nil 'move) | |
2716 line-okay (< (+ (length word) 1 ; 1 for space after word.. | 2776 line-okay (< (+ (length word) 1 ; 1 for space after word.. |
2717 (progn (end-of-line) (current-column))) | 2777 (progn (end-of-line) (current-column))) |
2718 80)) | 2778 80) |
2779 case-fold-search old-case-fold-search) | |
2719 (if (or (and search line-okay) | 2780 (if (or (and search line-okay) |
2720 (null search)) | 2781 (null search)) |
2721 (progn | 2782 (progn |
2722 (setq done t) | 2783 (setq done t) |
2723 (if (null search) | 2784 (if (null search) |
2732 (forward-line 1) | 2793 (forward-line 1) |
2733 (insert comment-end))))) | 2794 (insert comment-end))))) |
2734 (insert (concat " " word)))))))) | 2795 (insert (concat " " word)))))))) |
2735 | 2796 |
2736 | 2797 |
2737 (defconst ispell-version "ispell.el 3.0 -- Tue Apr 28 14:40:01 PDT 1998") | 2798 (defconst ispell-version "ispell.el 3.1 -- Mon Nov 30 20:32:48 PST 1998") |
2738 | 2799 |
2739 (provide 'ispell) | 2800 (provide 'ispell) |
2740 | 2801 |
2741 | 2802 |
2742 ;;; LOCAL VARIABLES AND BUFFER-LOCAL VALUE EXAMPLES. | 2803 ;;; LOCAL VARIABLES AND BUFFER-LOCAL VALUE EXAMPLES. |
2774 ; LocalWords: buf grep sync prev inc hilight olddot AIX ersion msg read's op | 2835 ; LocalWords: buf grep sync prev inc hilight olddot AIX ersion msg read's op |
2775 ; LocalWords: bufs pt multibyte cmd Quinlan uuencoded esp unidiff eg sc | 2836 ; LocalWords: bufs pt multibyte cmd Quinlan uuencoded esp unidiff eg sc |
2776 ; LocalWords: VM lns HTML eval american IspellPersDict | 2837 ; LocalWords: VM lns HTML eval american IspellPersDict |
2777 | 2838 |
2778 ;;; ispell.el ends here | 2839 ;;; ispell.el ends here |
2779 |