Mercurial > emacs
comparison lisp/textmodes/ispell.el @ 7607:0a3110658ada
Doc fixes.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 21 May 1994 08:04:20 +0000 |
parents | 3cc5ac274660 |
children | 67b7d1ea7b2e |
comparison
equal
deleted
inserted
replaced
7606:3cc5ac274660 | 7607:0a3110658ada |
---|---|
41 ;;; themselves. | 41 ;;; themselves. |
42 ;;; You particularly may want to change the default dictionary for your | 42 ;;; You particularly may want to change the default dictionary for your |
43 ;;; country and language. | 43 ;;; country and language. |
44 ;;; | 44 ;;; |
45 ;;; | 45 ;;; |
46 ;;; To fully install this, add this file to your GNU lisp directory and | 46 ;;; To fully install this, add this file to your Emacs Lisp directory and |
47 ;;; compile it with M-X byte-compile-file. Then add the following to the | 47 ;;; compile it with M-X byte-compile-file. Then add the following to the |
48 ;;; appropriate init file: | 48 ;;; appropriate init file: |
49 ;;; | 49 ;;; |
50 ;;; (autoload 'ispell-word "ispell" | 50 ;;; (autoload 'ispell-word "ispell" |
51 ;;; "Check the spelling of word in buffer." t) | 51 ;;; "Check the spelling of word in buffer." t) |
289 | 289 |
290 (defvar ispell-highlight-p t | 290 (defvar ispell-highlight-p t |
291 "*Highlight spelling errors when non-nil.") | 291 "*Highlight spelling errors when non-nil.") |
292 | 292 |
293 (defvar ispell-highlight-face 'highlight | 293 (defvar ispell-highlight-face 'highlight |
294 "*The face used for ispell highlighting. For Emacses with overlays. | 294 "*The face used for Ispell highlighting. For Emacses with overlays. |
295 Common values for GNU emacs are highlight, modeline, secondary-selection, | 295 Possible values are `highlight', `modeline', `secondary-selection', |
296 region, and underline. | 296 `region', and `underline'. |
297 This variable can be set by the user to whatever face they desire. | 297 This variable can be set by the user to whatever face they desire. |
298 It's most convenient if the cursor color and highlight color are | 298 It's most convenient if the cursor color and highlight color are |
299 slightly different.") | 299 slightly different.") |
300 | 300 |
301 (defvar ispell-check-comments nil | 301 (defvar ispell-check-comments nil |
302 "*Spelling of comments checked when non-nil.") | 302 "*Spelling of comments checked when non-nil.") |
303 | 303 |
304 (defvar ispell-query-replace-choices nil | 304 (defvar ispell-query-replace-choices nil |
305 "*Corrections made throughout region when non-nil. | 305 "*Corrections made throughout region when non-nil. |
306 Uses query-replace (\\[query-replace]) for corrections.") | 306 Uses `query-replace' (\\[query-replace]) for corrections.") |
307 | 307 |
308 (defvar ispell-skip-tib nil | 308 (defvar ispell-skip-tib nil |
309 "*Does not spell check tib(1) bibliography references when non-nil. | 309 "*Does not spell check `tib' bibliography references when non-nil. |
310 Skips any text between strings matching regular expressions | 310 Skips any text between strings matching regular expressions |
311 ispell-tib-ref-beginning and ispell-tib-ref-end is ignored. | 311 `ispell-tib-ref-beginning' and `ispell-tib-ref-end'. |
312 | 312 |
313 TeX users beware: Any field starting with [. will skip until a .] -- even | 313 TeX users beware: Any field starting with [. will skip until a .] -- even |
314 your whole buffer -- unless you set ispell-skip-tib to nil. That includes | 314 your whole buffer -- unless you set `ispell-skip-tib' to nil. That includes |
315 a [.5mm] type of number....") | 315 a [.5mm] type of number....") |
316 | 316 |
317 (defvar ispell-tib-ref-beginning "[[<]\\." | 317 (defvar ispell-tib-ref-beginning "[[<]\\." |
318 "Regexp matching the beginning of a Tib reference.") | 318 "Regexp matching the beginning of a Tib reference.") |
319 | 319 |
320 (defvar ispell-tib-ref-end "\\.[]>]" | 320 (defvar ispell-tib-ref-end "\\.[]>]" |
321 "Regexp matching the end of a Tib reference.") | 321 "Regexp matching the end of a Tib reference.") |
322 | 322 |
323 (defvar ispell-keep-choices-win t | 323 (defvar ispell-keep-choices-win t |
324 "*When not nil, the *Choices* window remains for spelling session. | 324 "*When not nil, the `*Choices*' window remains for spelling session. |
325 This minimizes redisplay thrashing.") | 325 This minimizes redisplay thrashing.") |
326 | 326 |
327 (defvar ispell-choices-win-default-height 2 | 327 (defvar ispell-choices-win-default-height 2 |
328 "*The default size of the *Choices* window, including status line. | 328 "*The default size of the `*Choices*' window, including status line. |
329 Must be greater than 1.") | 329 Must be greater than 1.") |
330 | 330 |
331 (defvar ispell-program-name "ispell" | 331 (defvar ispell-program-name "ispell" |
332 "Program invoked by \\[ispell-word] and \\[ispell-region] commands.") | 332 "Program invoked by \\[ispell-word] and \\[ispell-region] commands.") |
333 | 333 |
344 | 344 |
345 (defvar ispell-grep-command "/usr/bin/egrep" | 345 (defvar ispell-grep-command "/usr/bin/egrep" |
346 "Name of the grep command for search processes.") | 346 "Name of the grep command for search processes.") |
347 | 347 |
348 (defvar ispell-grep-options "-i" | 348 (defvar ispell-grep-options "-i" |
349 "Options for ispell-grep-command. | 349 "String of options to use when running the program in `ispell-grep-command'. |
350 Should probably be \"-i\" or \"-e\". | 350 Should probably be \"-i\" or \"-e\". |
351 Some machines (like the NeXT) don't support \"-i\"") | 351 Some machines (like the NeXT) don't support \"-i\"") |
352 | 352 |
353 (defvar ispell-look-command "/usr/bin/look" | 353 (defvar ispell-look-command "/usr/bin/look" |
354 "Name of the look command for search processes. | 354 "Name of the look command for search processes. |
355 Must contain complete path!") | 355 This must be an absolute file name.") |
356 | 356 |
357 (defvar ispell-look-p (file-exists-p ispell-look-command) | 357 (defvar ispell-look-p (file-exists-p ispell-look-command) |
358 "*Use look rather than grep when non-nil. | 358 "*Non-nil means use `look; rather than `grep'. |
359 Attempts to automatically reset if look not available") | 359 Default is based on whether `look' seems to be available.") |
360 | 360 |
361 (defvar ispell-have-new-look nil | 361 (defvar ispell-have-new-look nil |
362 "*Non-nil uses the `-r' option (regexp) when running look.") | 362 "*Non-nil means use the `-r' option (regexp) when running `look'.") |
363 | 363 |
364 (defvar ispell-look-options (if ispell-have-new-look "-dfr" "-df") | 364 (defvar ispell-look-options (if ispell-have-new-look "-dfr" "-df") |
365 "Options for ispell-look-command.") | 365 "String of command options for `ispell-look-command'.") |
366 | 366 |
367 (defvar ispell-use-ptys-p nil | 367 (defvar ispell-use-ptys-p nil |
368 "When non-nil, emacs will use pty's to communicate with ispell. | 368 "When non-nil, Emacs uses ptys to communicate with Ispell. |
369 When nil, emacs will use pipes.") | 369 When nil, Emacs uses pipes.") |
370 | 370 |
371 (defvar ispell-following-word nil | 371 (defvar ispell-following-word nil |
372 "*Check word under or following cursor when non-nil. | 372 "*Non-nil means `ispell-word' checks the word around or after point. |
373 Otherwise the preceding word is checked by ispell-word (\\[ispell-word]).") | 373 Otherwise `ispell-word' checks the preceding word.") |
374 | 374 |
375 (defvar ispell-help-in-bufferp nil | 375 (defvar ispell-help-in-bufferp nil |
376 "*Interactive keymap help is displayed in a buffer when non-nil. | 376 "*Non-nil means display interactive keymap help in a buffer. |
377 Otherwise help is shown in the minibuffer.") | 377 Otherwise use the minibuffer.") |
378 | 378 |
379 (defvar ispell-quietly nil | 379 (defvar ispell-quietly nil |
380 "*Messages suppressed in ispell-word when non-nil and interactive.") | 380 "*Non-nil means suppress messages in `ispell-word'.") |
381 | 381 |
382 (defvar ispell-format-word (function upcase) | 382 (defvar ispell-format-word (function upcase) |
383 "*Formatting function for displaying word being spell checked. | 383 "*Formatting function for displaying word being spell checked. |
384 The function must take one string argument and return a string.") | 384 The function must take one string argument and return a string.") |
385 | 385 |
386 (defvar ispell-personal-dictionary nil | 386 (defvar ispell-personal-dictionary nil |
387 "*A string or nil. If nil, the default directory ~/.ispell_words is used.") | 387 "*File name of your personal spelling dictionary. |
388 If nil, default dictionary `~/.ispell_words' is used.") | |
388 | 389 |
389 (defvar ispell-silently-savep nil | 390 (defvar ispell-silently-savep nil |
390 "*When non-nil, save the personal dictionary without user verification.") | 391 "*When non-nil, save the personal dictionary without confirmation.") |
391 | 392 |
392 ;;; This variable contains the current dictionary being used if the ispell | 393 ;;; This variable contains the current dictionary being used if the ispell |
393 ;;; process is running. Otherwise it contains the global default. | 394 ;;; process is running. Otherwise it contains the global default. |
394 (defvar ispell-dictionary nil | 395 (defvar ispell-dictionary nil |
395 "If non-nil, a dictionary to use instead of the default one. | 396 "If non-nil, a dictionary to use instead of the default one. |
396 This is passed to the ispell process using the \"-d\" switch and is | 397 This is passed to the ispell process using the `-d' switch and is |
397 used as key in ispell-dictionary-alist (which see). | 398 used as key in `ispell-dictionary-alist' (which see). |
398 | 399 |
399 You should set this variable before your first call to ispell (e.g. in | 400 You should set this variable before your first use of Emacs spell-checking |
400 your .emacs), or use the \\[ispell-change-dictionary] command to | 401 commands in the Emacs session, or else use the \\[ispell-change-dictionary] command to |
401 change it, as changing this variable only takes effect in a newly | 402 change it. Otherwise, this variable only takes effect in a newly |
402 started ispell process.") | 403 started Ispell process.") |
403 | 404 |
404 (defvar ispell-extra-args nil | 405 (defvar ispell-extra-args nil |
405 "*If non-nil, a list of extra switches to pass to the ispell program. | 406 "*If non-nil, a list of extra switches to pass to the Ispell program. |
406 For example, '(\"-W\" \"3\") to cause it to accept all 1-3 character | 407 For example, '(\"-W\" \"3\") to cause it to accept all 1-3 character |
407 words as correct. See also `ispell-dictionary-alist', which may be used | 408 words as correct. See also `ispell-dictionary-alist', which may be used |
408 for language-specific arguments.") | 409 for language-specific arguments.") |
409 | 410 |
410 (defvar ispell-dictionary-alist ; sk 9-Aug-1991 18:28 | 411 (defvar ispell-dictionary-alist ; sk 9-Aug-1991 18:28 |
442 Each element of this list is also a list: | 443 Each element of this list is also a list: |
443 | 444 |
444 \(DICTIONARY-NAME CASECHARS NOT-CASECHARS OTHERCHARS MANY-OTHERCHARS-P | 445 \(DICTIONARY-NAME CASECHARS NOT-CASECHARS OTHERCHARS MANY-OTHERCHARS-P |
445 ISPELL-ARGS EXTENDED-CHARACTER-MODE\) | 446 ISPELL-ARGS EXTENDED-CHARACTER-MODE\) |
446 | 447 |
447 DICTIONARY-NAME is a possible value of variable ispell-dictionary, nil | 448 DICTIONARY-NAME is a possible value of variable `ispell-dictionary', nil |
448 means the default dictionary. | 449 means the default dictionary. |
449 | 450 |
450 CASECHARS is a regular expression of valid characters that comprise a | 451 CASECHARS is a regular expression of valid characters that comprise a |
451 word. | 452 word. |
452 | 453 |
464 | 465 |
465 ISPELL-ARGS is a list of additional arguments passed to the ispell | 466 ISPELL-ARGS is a list of additional arguments passed to the ispell |
466 subprocess. | 467 subprocess. |
467 | 468 |
468 EXTENDED-CHARACTER-MODE should be used when dictionaries are used which | 469 EXTENDED-CHARACTER-MODE should be used when dictionaries are used which |
469 have been configured in ispell's parse.y. (For example, umlauts | 470 have been configured in Ispell's parse.y. (For example, umlauts |
470 can be encoded as \\\"a, a\\\", \"a, ...) Defaults are ~tex and ~nroff | 471 can be encoded as \\\"a, a\\\", \"a, ...) Defaults are ~tex and ~nroff |
471 in english. This has the same effect as the command-line `-T' option. | 472 in English. This has the same effect as the command-line `-T' option. |
472 The buffer Major Mode controls ispell's parsing in tex or nroff mode, | 473 The buffer Major Mode controls Ispell's parsing in tex or nroff mode, |
473 but the dictionary can control the extended character mode. | 474 but the dictionary can control the extended character mode. |
474 Both defaults can be overruled in a buffer-local fashion. See | 475 Both defaults can be overruled in a buffer-local fashion. See |
475 ispell-parsing-keyword for details on this. | 476 `ispell-parsing-keyword' for details on this. |
476 | 477 |
477 Note that the CASECHARS and OTHERCHARS slots of the alist should | 478 Note that the CASECHARS and OTHERCHARS slots of the alist should |
478 contain the same character set as casechars and otherchars in the | 479 contain the same character set as casechars and otherchars in the |
479 language.aff file \(e.g., english.aff\).") | 480 language.aff file \(e.g., english.aff\).") |
480 | 481 |
514 (progn | 515 (progn |
515 (delete-menu-item '("Edit" "Spell")) ; in case already defined | 516 (delete-menu-item '("Edit" "Spell")) ; in case already defined |
516 (add-menu '("Edit") "Spell" ispell-menu-lucid))))) | 517 (add-menu '("Edit") "Spell" ispell-menu-lucid))))) |
517 | 518 |
518 ;; cond-case: | 519 ;; cond-case: |
519 ((and (featurep 'menu-bar) ; GNU emacs | 520 ((and (featurep 'menu-bar) |
520 (string-lessp "19" emacs-version)) | 521 (string-lessp "19" emacs-version)) |
521 (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist))) | 522 (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist))) |
522 name) | 523 name) |
523 (defvar ispell-menu-map nil) | 524 (defvar ispell-menu-map nil) |
524 ;; Can put in defvar when external defines are removed. | 525 ;; Can put in defvar when external defines are removed. |
583 (nth 5 (assoc ispell-dictionary ispell-dictionary-alist))) | 584 (nth 5 (assoc ispell-dictionary ispell-dictionary-alist))) |
584 (defun ispell-get-extended-character-mode () | 585 (defun ispell-get-extended-character-mode () |
585 (nth 6 (assoc ispell-dictionary ispell-dictionary-alist))) | 586 (nth 6 (assoc ispell-dictionary ispell-dictionary-alist))) |
586 | 587 |
587 (defvar ispell-process nil | 588 (defvar ispell-process nil |
588 "The process object for Ispell") | 589 "The process object for Ispell.") |
589 | 590 |
590 (defvar ispell-pdict-modified-p nil | 591 (defvar ispell-pdict-modified-p nil |
591 "T when the personal dictionary has modifications that need to be written.") | 592 "Non-nil means personal dictionary has modifications to be saved.") |
592 | 593 |
593 ;;; If you want to save the dictionary when quitting, must do so explicitly. | 594 ;;; If you want to save the dictionary when quitting, must do so explicitly. |
594 (defvar ispell-quit nil | 595 ;; When non-nil, the spell session is terminated. |
595 "When non-nil the spell session is terminated. | 596 ;; When numeric, contains cursor location in buffer, and cursor remains there. |
596 When numeric, contains cursor location in buffer, and cursor remains there.") | 597 (defvar ispell-quit nil) |
597 | 598 |
598 (defvar ispell-filter nil | 599 (defvar ispell-filter nil |
599 "Output filter from piped calls to ispell.") | 600 "Output filter from piped calls to Ispell.") |
600 | 601 |
601 (defvar ispell-filter-continue nil | 602 (defvar ispell-filter-continue nil |
602 "Control variable for ispell filter function.") | 603 "Control variable for Ispell filter function.") |
603 | 604 |
604 (defvar ispell-process-directory nil | 605 (defvar ispell-process-directory nil |
605 "The directory where ispell-process was started.") | 606 "The directory where `ispell-process' was started.") |
606 | 607 |
607 (defvar ispell-query-replace-marker (make-marker) | 608 (defvar ispell-query-replace-marker (make-marker) |
608 "Marker for query-replace processing.") | 609 "Marker for `query-replace' processing.") |
609 | 610 |
610 (defvar ispell-checking-message nil | 611 (defvar ispell-checking-message nil |
611 "Non-nil when we're checking a mail message") | 612 "Non-nil when we're checking a mail message") |
612 | 613 |
613 (defconst ispell-choices-buffer "*Choices*") | 614 (defconst ispell-choices-buffer "*Choices*") |
614 | 615 |
615 (defvar ispell-overlay nil "overlay variable for ispell") | 616 (defvar ispell-overlay nil "Overlay variable for Ispell highlighting.") |
616 | 617 |
617 ;;; *** Buffer Local Definitions *** | 618 ;;; *** Buffer Local Definitions *** |
618 | 619 |
619 ;;; This is the local dictionary to use. When nil the default dictionary will | 620 ;;; This is the local dictionary to use. When nil the default dictionary will |
620 ;;; be used. Do not redefine default value or it will override the global! | 621 ;;; be used. Do not redefine default value or it will override the global! |
621 (defvar ispell-local-dictionary nil | 622 (defvar ispell-local-dictionary nil |
622 "A buffer local variable. If non-nil, a dictionary to be used when running | 623 "If non-nil, a dictionary to use for Ispell commands in this buffer. |
623 an ispell-command in this buffer. Setting ispell-local-dictionary to a value | 624 The value should be a string, which is a file name. |
624 has the same effect as calling \\[ispell-change-dictionary] with that value. | 625 This variable becomes buffer-local when set in any fashion. |
625 This variable is automatically set when defined in the file with either | 626 |
626 ispell-dictionary-keyword or the Local Variable syntax. | 627 Setting ispell-local-dictionary to a value has the same effect as |
627 If using Local Variable syntax, the dictionary must be a string.") | 628 calling \\[ispell-change-dictionary] with that value. This variable |
629 is automatically set when defined in the file with either | |
630 `ispell-dictionary-keyword' or the Local Variable syntax.") | |
628 | 631 |
629 (make-variable-buffer-local 'ispell-local-dictionary) | 632 (make-variable-buffer-local 'ispell-local-dictionary) |
630 | 633 |
631 ;; Use default directory, unless locally set. | 634 ;; Use default directory, unless locally set. |
632 (set-default 'ispell-local-dictionary nil) | 635 (set-default 'ispell-local-dictionary nil) |
637 There can be multiple of these keywords in the file.") | 640 There can be multiple of these keywords in the file.") |
638 | 641 |
639 (defconst ispell-dictionary-keyword "Local IspellDict: " | 642 (defconst ispell-dictionary-keyword "Local IspellDict: " |
640 "The keyword for local dictionary definitions. | 643 "The keyword for local dictionary definitions. |
641 There should be only one dictionary keyword definition per file, and it | 644 There should be only one dictionary keyword definition per file, and it |
642 should be followed by a correct dictionary name in ispell-dictionary-alist.") | 645 should be followed by a correct dictionary name in `ispell-dictionary-alist'.") |
643 | 646 |
644 (defconst ispell-parsing-keyword "Local IspellParsing: " | 647 (defconst ispell-parsing-keyword "Local IspellParsing: " |
645 "The keyword for overriding default ispell parsing. | 648 "The keyword for overriding default Ispell parsing. |
646 Determined by the buffer's major mode and extended-character mode as well as | 649 Determined by the buffer's major mode and extended-character mode as well as |
647 the default dictionary. | 650 the default dictionary. |
648 | 651 |
649 The above keyword string should be followed by `latex-mode' or | 652 The above keyword string should be followed by `latex-mode' or |
650 `nroff-mode' to put the current buffer into the desired parsing mode. | 653 `nroff-mode' to put the current buffer into the desired parsing mode. |
652 Extended character mode can be changed for this buffer by placing | 655 Extended character mode can be changed for this buffer by placing |
653 a `~' followed by an extended-character mode -- such as `~.tex'.") | 656 a `~' followed by an extended-character mode -- such as `~.tex'.") |
654 | 657 |
655 (defvar ispell-local-pdict ispell-personal-dictionary | 658 (defvar ispell-local-pdict ispell-personal-dictionary |
656 "A buffer local variable containing the current personal dictionary. | 659 "A buffer local variable containing the current personal dictionary. |
657 If a personal dictionary is specified for the current buffer which is | 660 If non-nil, the value must be a string, which is a file name. |
658 different from the current personal dictionary, the effect will be similar | 661 |
662 If you specify a personal dictionary for the current buffer which is | |
663 different from the current personal dictionary, the effect is similar | |
659 to calling \\[ispell-change-dictionary]. This variable is automatically | 664 to calling \\[ispell-change-dictionary]. This variable is automatically |
660 set when defined in the file with either ispell-pdict-keyword or the | 665 set when defined in the file with either `ispell-pdict-keyword' or the |
661 local variable syntax. | 666 local variable syntax.") |
662 | |
663 If using Local variable syntax, the dictionary must be nil or a string.") | |
664 | 667 |
665 (make-variable-buffer-local 'ispell-local-pdict) | 668 (make-variable-buffer-local 'ispell-local-pdict) |
666 | 669 |
667 (defconst ispell-pdict-keyword "Local IspellPersDict: " | 670 (defconst ispell-pdict-keyword "Local IspellPersDict: " |
668 "The keyword for defining buffer local dictionaries.") | 671 "The keyword for defining buffer local dictionaries.") |
671 "Contains the buffer name if local word definitions were used. | 674 "Contains the buffer name if local word definitions were used. |
672 Ispell is then restarted because the local words could conflict.") | 675 Ispell is then restarted because the local words could conflict.") |
673 | 676 |
674 (defvar ispell-parser 'use-mode-name | 677 (defvar ispell-parser 'use-mode-name |
675 "*Indicates whether ispell should parse the current buffer as TeX Code. | 678 "*Indicates whether ispell should parse the current buffer as TeX Code. |
676 Special value 'use-mode-name tries to guess using the name of major-mode. | 679 Special value `use-mode-name' tries to guess using the name of major-mode. |
677 Default parser is 'nroff. | 680 Default parser is 'nroff. |
678 Currently the only other valid parser is 'tex. | 681 Currently the only other valid parser is 'tex. |
679 | 682 |
680 You can set this variable in hooks in your init file -- eg: | 683 You can set this variable in hooks in your init file -- eg: |
681 | 684 |
694 ;;;###autoload (define-key global-map "\M-$" 'ispell-word) | 697 ;;;###autoload (define-key global-map "\M-$" 'ispell-word) |
695 | 698 |
696 ;;;###autoload | 699 ;;;###autoload |
697 (defun ispell-word (&optional following quietly continue) | 700 (defun ispell-word (&optional following quietly continue) |
698 "Check spelling of word under or before the cursor. | 701 "Check spelling of word under or before the cursor. |
699 If word not found in dictionary, display possible corrections in a window | 702 If the word is not found in dictionary, display possible corrections |
700 and let user select. | 703 in a window and so you can choose one. |
704 | |
701 With a prefix argument (or if CONTINUE is non-nil), | 705 With a prefix argument (or if CONTINUE is non-nil), |
702 resume interrupted spell-checking of a buffer or region. | 706 resume interrupted spell-checking of a buffer or region. |
707 | |
703 If optional argument FOLLOWING is non-nil or if `ispell-following-word' | 708 If optional argument FOLLOWING is non-nil or if `ispell-following-word' |
704 is non-nil when called interactively, then the following word | 709 is non-nil when called interactively, then the following word |
705 \(rather than preceding\) is checked when the cursor is not over a word. | 710 \(rather than preceding\) is checked when the cursor is not over a word. |
706 When the optional argument QUIETLY is non-nil or `ispell-quietly' is non-nil | 711 When the optional argument QUIETLY is non-nil or `ispell-quietly' is non-nil |
707 when called interactively, non-corrective messages are suppressed. | 712 when called interactively, non-corrective messages are suppressed. |
1081 "Display a list of the options available when a misspelling is encountered. | 1086 "Display a list of the options available when a misspelling is encountered. |
1082 | 1087 |
1083 Selections are: | 1088 Selections are: |
1084 | 1089 |
1085 DIGIT: Replace the word with a digit offered in the *Choices* buffer. | 1090 DIGIT: Replace the word with a digit offered in the *Choices* buffer. |
1086 ' ': Accept word this time. | 1091 SPC: Accept word this time. |
1087 'i': Accept word and insert into private dictionary. | 1092 `i': Accept word and insert into private dictionary. |
1088 'a': Accept word for this session. | 1093 `a': Accept word for this session. |
1089 'A': Accept word and place in `buffer-local dictionary'. | 1094 `A': Accept word and place in `buffer-local dictionary'. |
1090 'r': Replace word with typed-in value. Rechecked. | 1095 `r': Replace word with typed-in value. Rechecked. |
1091 'R': Replace word with typed-in value. Query-replaced in buffer. Rechecked. | 1096 `R': Replace word with typed-in value. Query-replaced in buffer. Rechecked. |
1092 '?': Show these commands. | 1097 `?': Show these commands. |
1093 'x': Exit spelling buffer. Move cursor to original point. | 1098 `x': Exit spelling buffer. Move cursor to original point. |
1094 'X': Exit spelling buffer. Leaves cursor at the current point, and permits | 1099 `X': Exit spelling buffer. Leaves cursor at the current point, and permits |
1095 the aborted check to be completed later. | 1100 the aborted check to be completed later. |
1096 'q': Quit spelling session (Kills ispell process). | 1101 `q': Quit spelling session (Kills ispell process). |
1097 'l': Look up typed-in replacement in alternate dictionary. Wildcards okay. | 1102 `l': Look up typed-in replacement in alternate dictionary. Wildcards okay. |
1098 'u': Like 'i', but the word is lower-cased first. | 1103 `u': Like `i', but the word is lower-cased first. |
1099 'm': Like 'i', but allows one to include dictionary completion information. | 1104 `m': Like `i', but allows one to include dictionary completion information. |
1100 'C-l': redraws screen | 1105 `C-l': redraws screen |
1101 'C-r': recursive edit | 1106 `C-r': recursive edit |
1102 'C-z': suspend emacs or iconify frame" | 1107 `C-z': suspend emacs or iconify frame" |
1103 | 1108 |
1104 (let ((help-1 (concat "[r/R]eplace word; [a/A]ccept for this session; " | 1109 (let ((help-1 (concat "[r/R]eplace word; [a/A]ccept for this session; " |
1105 "[i]nsert into private dictionary")) | 1110 "[i]nsert into private dictionary")) |
1106 (help-2 (concat "[l]ook a word up in alternate dictionary; " | 1111 (help-2 (concat "[l]ook a word up in alternate dictionary; " |
1107 "e[x/X]it; [q]uit session")) | 1112 "e[x/X]it; [q]uit session")) |
1266 (defun ispell-highlight-spelling-error-overlay (start end &optional highlight) | 1271 (defun ispell-highlight-spelling-error-overlay (start end &optional highlight) |
1267 "Highlight the word from START to END using overlays. | 1272 "Highlight the word from START to END using overlays. |
1268 When the optional third arg HIGHLIGHT is set, the word is highlighted | 1273 When the optional third arg HIGHLIGHT is set, the word is highlighted |
1269 otherwise it is displayed normally. | 1274 otherwise it is displayed normally. |
1270 | 1275 |
1271 The variable ispell-highlight-face selects the face that will be used | 1276 The variable `ispell-highlight-face' selects the face to use for highlighting." |
1272 for highlighting." | |
1273 (if highlight | 1277 (if highlight |
1274 (progn | 1278 (progn |
1275 (setq ispell-overlay (make-overlay start end)) | 1279 (setq ispell-overlay (make-overlay start end)) |
1276 (overlay-put ispell-overlay 'face ispell-highlight-face)) | 1280 (overlay-put ispell-overlay 'face ispell-highlight-face)) |
1277 (delete-overlay ispell-overlay))) | 1281 (delete-overlay ispell-overlay))) |
1309 (set-window-start (next-window) top)))) | 1313 (set-window-start (next-window) top)))) |
1310 | 1314 |
1311 | 1315 |
1312 ;;; Should we add a compound word match return value? | 1316 ;;; Should we add a compound word match return value? |
1313 (defun ispell-parse-output (output) | 1317 (defun ispell-parse-output (output) |
1314 "Parse the OUTPUT string of `ispell' and return: | 1318 "Parse the OUTPUT string from Ispell and return: |
1315 1: T for an exact match. | 1319 1: t for an exact match. |
1316 2: A string containing the root word for a match via suffix removal. | 1320 2: A string containing the root word for a match via suffix removal. |
1317 3: A list of possible correct spellings of the format: | 1321 3: A list of possible correct spellings of the format: |
1318 '(\"ORIGINAL-WORD\" OFFSET MISS-LIST GUESS-LIST) | 1322 '(\"ORIGINAL-WORD\" OFFSET MISS-LIST GUESS-LIST) |
1319 ORIGINAL-WORD is a string of the possibly misspelled word. | 1323 ORIGINAL-WORD is a string of the possibly misspelled word. |
1320 OFFSET is an integer giving the line offset of the word. | 1324 OFFSET is an integer giving the line offset of the word. |
1449 (concat extended-char-mode "\n")))) | 1453 (concat extended-char-mode "\n")))) |
1450 (process-kill-without-query ispell-process))) | 1454 (process-kill-without-query ispell-process))) |
1451 | 1455 |
1452 ;;;###autoload | 1456 ;;;###autoload |
1453 (defun ispell-kill-ispell (&optional no-error) | 1457 (defun ispell-kill-ispell (&optional no-error) |
1454 "Kill current ispell process (so that you may start a fresh one). | 1458 "Kill current Ispell process (so that you may start a fresh one). |
1455 With NO-ERROR, just return non-nil if there was no ispell running." | 1459 With NO-ERROR, just return non-nil if there was no Ispell running." |
1456 (interactive) | 1460 (interactive) |
1457 (if (not (and ispell-process | 1461 (if (not (and ispell-process |
1458 (eq (process-status ispell-process) 'run))) | 1462 (eq (process-status ispell-process) 'run))) |
1459 (or no-error | 1463 (or no-error |
1460 (error "There is no ispell process running!")) | 1464 (error "There is no ispell process running!")) |
1464 nil)) | 1468 nil)) |
1465 | 1469 |
1466 | 1470 |
1467 ;;;###autoload | 1471 ;;;###autoload |
1468 (defun ispell-change-dictionary (dict &optional arg) | 1472 (defun ispell-change-dictionary (dict &optional arg) |
1469 "Change ispell-dictionary (q.v.) and kill old ispell process. | 1473 "Change `ispell-dictionary' (q.v.) and kill old Ispell process. |
1470 A new one will be started as soon as necessary. | 1474 A new one will be started as soon as necessary. |
1471 | 1475 |
1472 By just answering RET you can find out what the current dictionary is. | 1476 By just answering RET you can find out what the current dictionary is. |
1473 | 1477 |
1474 With prefix argument, set the default directory." | 1478 With prefix argument, set the default directory." |
1880 "Check the spelling of a mail message or news post. | 1884 "Check the spelling of a mail message or news post. |
1881 Don't check spelling of message headers except the Subject field. | 1885 Don't check spelling of message headers except the Subject field. |
1882 Don't check included messages. | 1886 Don't check included messages. |
1883 | 1887 |
1884 To abort spell checking of a message REGION and send the message anyway, | 1888 To abort spell checking of a message REGION and send the message anyway, |
1885 use the 'x' or 'q' command. (Any subsequent regions will be checked.) | 1889 use the `x' or `q' command. (Any subsequent regions will be checked.) |
1886 The 'X' command aborts the message send so that you can edit the buffer. | 1890 The `X' command aborts the message send so that you can edit the buffer. |
1887 | 1891 |
1888 To spell-check whenever a message is sent, include the appropriate lines | 1892 To spell-check whenever a message is sent, include the appropriate lines |
1889 in your .emacs file: | 1893 in your .emacs file: |
1890 (add-hook 'news-inews-hook 'ispell-message) | 1894 (add-hook 'news-inews-hook 'ispell-message) |
1891 (add-hook 'mail-send-hook 'ispell-message) | 1895 (add-hook 'mail-send-hook 'ispell-message) |
1892 (add-hook 'mh-before-send-letter-hook 'ispell-message) | 1896 (add-hook 'mh-before-send-letter-hook 'ispell-message) |
1893 | 1897 |
1894 Or you can bind the function C-c i in gnus or mail by setting | 1898 you can bind this to the key C-c i in GNUS or mail by adding to |
1895 news-reply-mode-hook or mail-mode-hook to the following lambda expression: | 1899 `news-reply-mode-hook' or `mail-mode-hook' the following lambda expression: |
1896 (function (lambda () (local-set-key \"\\C-ci\" 'ispell-message)))" | 1900 (function (lambda () (local-set-key \"\\C-ci\" 'ispell-message)))" |
1897 (interactive) | 1901 (interactive) |
1898 (save-excursion | 1902 (save-excursion |
1899 (goto-char (point-min)) | 1903 (goto-char (point-min)) |
1900 (let* ((internal-messagep (save-excursion | 1904 (let* ((internal-messagep (save-excursion |
1917 (concat "\\(" (sc-cite-regexp) "\\)" "\\|" | 1921 (concat "\\(" (sc-cite-regexp) "\\)" "\\|" |
1918 (ispell-non-empty-string sc-reference-tag-string))) | 1922 (ispell-non-empty-string sc-reference-tag-string))) |
1919 ((featurep 'sc) ; sc 2.3 | 1923 ((featurep 'sc) ; sc 2.3 |
1920 (concat "\\(" sc-cite-regexp "\\)" "\\|" | 1924 (concat "\\(" sc-cite-regexp "\\)" "\\|" |
1921 (ispell-non-empty-string sc-reference-tag-string))) | 1925 (ispell-non-empty-string sc-reference-tag-string))) |
1922 ((equal major-mode 'news-reply-mode) ;Gnus | 1926 ((equal major-mode 'news-reply-mode) ;GNUS |
1923 (concat "In article <" "\\|" | 1927 (concat "In article <" "\\|" |
1924 (if mail-yank-prefix | 1928 (if mail-yank-prefix |
1925 (ispell-non-empty-string mail-yank-prefix) | 1929 (ispell-non-empty-string mail-yank-prefix) |
1926 "^ \\|^\t"))) | 1930 "^ \\|^\t"))) |
1927 ((equal major-mode 'mh-letter-mode) ; mh mail message | 1931 ((equal major-mode 'mh-letter-mode) ; mh mail message |
1998 (ispell-buffer-local-words) ; Will initialize ispell-process. | 2002 (ispell-buffer-local-words) ; Will initialize ispell-process. |
1999 (ispell-buffer-local-parsing)) | 2003 (ispell-buffer-local-parsing)) |
2000 | 2004 |
2001 | 2005 |
2002 (defun ispell-buffer-local-parsing () | 2006 (defun ispell-buffer-local-parsing () |
2003 "Place ispell into parsing mode for this buffer. | 2007 "Place Ispell into parsing mode for this buffer. |
2004 Overrides the default parsing mode. | 2008 Overrides the default parsing mode. |
2005 Includes latex/nroff modes and extended character mode." | 2009 Includes latex/nroff modes and extended character mode." |
2006 ;; (ispell-init-process) must already be called. | 2010 ;; (ispell-init-process) must already be called. |
2007 (process-send-string ispell-process "!\n") ; Put process in terse mode. | 2011 (process-send-string ispell-process "!\n") ; Put process in terse mode. |
2008 ;; We assume all major modes with "tex-mode" in them should use latex parsing | 2012 ;; We assume all major modes with "tex-mode" in them should use latex parsing |
2039 ;;; Can kill the current ispell process | 2043 ;;; Can kill the current ispell process |
2040 | 2044 |
2041 (defun ispell-buffer-local-dict () | 2045 (defun ispell-buffer-local-dict () |
2042 "Initializes local dictionary. | 2046 "Initializes local dictionary. |
2043 When a dictionary is defined in the buffer (see variable | 2047 When a dictionary is defined in the buffer (see variable |
2044 ispell-dictionary-keyword), it will override the local setting | 2048 `ispell-dictionary-keyword'), it will override the local setting |
2045 from \\[ispell-change-dictionary]. | 2049 from \\[ispell-change-dictionary]. |
2046 Both should not be used to define a buffer-local dictionary." | 2050 Both should not be used to define a buffer-local dictionary." |
2047 (save-excursion | 2051 (save-excursion |
2048 (goto-char (point-min)) | 2052 (goto-char (point-min)) |
2049 (let (end) | 2053 (let (end) |
2071 (not (equal ispell-local-dictionary ispell-dictionary))) | 2075 (not (equal ispell-local-dictionary ispell-dictionary))) |
2072 (ispell-change-dictionary ispell-local-dictionary))) | 2076 (ispell-change-dictionary ispell-local-dictionary))) |
2073 | 2077 |
2074 | 2078 |
2075 (defun ispell-buffer-local-words () | 2079 (defun ispell-buffer-local-words () |
2076 "Loads the buffer-local \"dictionary\" in the current buffer." | 2080 "Loads the buffer-local dictionary in the current buffer." |
2077 (if (and ispell-buffer-local-name | 2081 (if (and ispell-buffer-local-name |
2078 (not (equal ispell-buffer-local-name (buffer-name)))) | 2082 (not (equal ispell-buffer-local-name (buffer-name)))) |
2079 (progn | 2083 (progn |
2080 (ispell-kill-ispell t) | 2084 (ispell-kill-ispell t) |
2081 (setq ispell-buffer-local-name nil))) | 2085 (setq ispell-buffer-local-name nil))) |