Mercurial > emacs
comparison lisp/textmodes/ispell.el @ 30929:3d5ccbaddc59
Set to standard author/maintainer/keyword fields.
Fine tuning to menu map appearance and operation, and added help.
Remove `start' and `end' error messages when compiling.
(ispell-choices-win-default-height): Fixed comment string.
(ispell-dictionary-alist-1): Fixed regexp in castellano and
castellano8 dictionaries.
(ispell-dictionary-alist-3): Fixed regexp in francais dictionary.
(ispell-dictionary-alist-4): Fixed regexp in francais-tex
dictionary, added italiano dictionary.
(ispell-skip-region-alist): Removed regexp thrashing when `-' is a
word character
(ispell-tex-skip-alists): Added psfig support.
(ispell-skip-html): Renamed from ispell-skip-sgml.
(ispell-begin-skip-region-regexp, ispell-skip-region)
(ispell-minor-check): Improved html skipping support to skip across
code, and recognize `&' commands without propper `;' syntax;
(ispell-process-line): Fix alignment error when manually
correcting spelling.
(ispell): Fix comment string.
(ispell-add-per-file-word-list): Always put word list on new line.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 17 Aug 2000 20:54:01 +0000 |
parents | a6e11bca863a |
children | 97846db00c98 |
comparison
equal
deleted
inserted
replaced
30928:9747d7fb3ba9 | 30929:3d5ccbaddc59 |
---|---|
1 ;;; ispell.el --- Interface to International Ispell Versions 3.1 and 3.2 | 1 ;;; ispell.el --- Interface to International Ispell Versions 3.1 and 3.2 |
2 | 2 |
3 ;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Authors : Ken Stevens <k.stevens@ieee.org> | 5 ;; Author: Ken Stevens <k.stevens@ieee.org> |
6 ;; Stevens Mod Date: Fri Jan 28 17:16:58 PST 2000 | 6 ;; Maintainer: Ken Stevens <k.stevens@ieee.org> |
7 ;; Stevens Revision: 3.4 beta | 7 ;; Stevens Mod Date: Fri Aug 4 09:41:50 PDT 2000 |
8 ;; Stevens Revision: 3.4 | |
8 ;; Status : Release with 3.1.12+ and 3.2.0+ ispell. | 9 ;; Status : Release with 3.1.12+ and 3.2.0+ ispell. |
9 ;; Bug Reports : ispell-el-bugs@itcorp.com | 10 ;; Bug Reports : ispell-el-bugs@itcorp.com |
10 ;; Web Site : http://kdstevens.com/~stevens/ispell-page.html | 11 ;; Web Site : http://kdstevens.com/~stevens/ispell-page.html |
11 ;; Keywords: unix wp | 12 ;; Keywords: unix wp |
12 | 13 |
126 | 127 |
127 ;; HISTORY | 128 ;; HISTORY |
128 | 129 |
129 ;; Modifications made in latest versions: | 130 ;; Modifications made in latest versions: |
130 | 131 |
131 ;; Revision 3.4 beta 2000/1/28 17:16:58 kss | 132 ;; Revision 3.4 2000/8/4 09:41:50 kss |
133 ;; Support new color display functions. | |
134 ;; Fixed misalignment offset bug when replacing a string after a shift made. | |
135 ;; Set to standard Author/Maintainer heading, | |
136 ;; ensure localwords lists are separated from the text by newline. (Dave Love) | |
137 ;; Added dictionary definition for Italian (William Deakin) | |
138 ;; HTML region skipping greatly improved. (Chuck D. Phillips) | |
139 ;; improved menus. Fixed regexp matching http/email addresses. | |
132 ;; one arg always for xemacs sleep-for (gunnar Evermann) | 140 ;; one arg always for xemacs sleep-for (gunnar Evermann) |
133 ;; support for synchronous processes (Eli Zaretskii) | 141 ;; support for synchronous processes (Eli Zaretskii) |
134 | 142 |
135 ;; Revision 3.3 1999/11/29 11:38:34 kss | 143 ;; Revision 3.3 1999/11/29 11:38:34 kss |
136 ;; Only word replacements entered in from the keyboard are rechecked. | 144 ;; Only word replacements entered in from the keyboard are rechecked. |
277 :group 'ispell) | 285 :group 'ispell) |
278 | 286 |
279 (defcustom ispell-choices-win-default-height (if ispell-graphic-p 3 2) | 287 (defcustom ispell-choices-win-default-height (if ispell-graphic-p 3 2) |
280 "*The default size of the `*Choices*' window, including mode line. | 288 "*The default size of the `*Choices*' window, including mode line. |
281 Must be greater than 1. | 289 Must be greater than 1. |
282 XEmacs modeline is thicker than a line of text, so it partially covers the | 290 A Graphic capable modeline is thicker than a line of text, so it partially |
283 last line of text in the buffer. Include an extra line in XEmacs to see | 291 covers the last line of text in the choices buffer. Include an extra line |
284 all of the choices clearly." | 292 for graphic capable displays to see all of the choices clearly." |
285 :type 'integer | 293 :type 'integer |
286 :group 'ispell) | 294 :group 'ispell) |
287 | 295 |
288 (defcustom ispell-program-name "ispell" | 296 (defcustom ispell-program-name "ispell" |
289 "Program invoked by \\[ispell-word] and \\[ispell-region] commands." | 297 "Program invoked by \\[ispell-word] and \\[ispell-region] commands." |
374 The following values are supported: | 382 The following values are supported: |
375 nil Expand the minibuffer and display a short help message | 383 nil Expand the minibuffer and display a short help message |
376 there for a couple of seconds. | 384 there for a couple of seconds. |
377 t Pop up a new buffer and display a short help message there | 385 t Pop up a new buffer and display a short help message there |
378 for a couple of seconds. | 386 for a couple of seconds. |
379 electric Pop up a new buffer and display a long help message there. | 387 electric Pop up a new buffer and display a long help message there. |
380 User can browse and then exit the help mode." | 388 User can browse and then exit the help mode." |
381 :type '(choice (const electric) (const :tag "off" nil) (const :tag "on" t)) | 389 :type '(choice (const electric) (const :tag "off" nil) (const :tag "on" t)) |
382 :group 'ispell) | 390 :group 'ispell) |
383 | 391 |
384 (defcustom ispell-quietly nil | 392 (defcustom ispell-quietly nil |
446 :type '(repeat string) | 454 :type '(repeat string) |
447 :group 'ispell) | 455 :group 'ispell) |
448 | 456 |
449 | 457 |
450 | 458 |
451 (defcustom ispell-skip-sgml 'use-mode-name | 459 (defcustom ispell-skip-html 'use-mode-name |
452 "*Indicates whether ispell should skip spell checking of SGML markup. | 460 "*Indicates whether ispell should skip spell checking of SGML markup. |
453 If t, always skip SGML markup; if nil, never skip; if non-t and non-nil, | 461 If t, always skip SGML markup; if nil, never skip; if non-t and non-nil, |
454 guess whether SGML markup should be skipped according to the name of the | 462 guess whether SGML markup should be skipped according to the name of the |
455 buffer's major mode." | 463 buffer's major mode." |
456 :type '(choice (const :tag "always" t) (const :tag "never" nil) | 464 :type '(choice (const :tag "always" t) (const :tag "never" nil) |
473 (repeat :tag "Ispell command line args" | 481 (repeat :tag "Ispell command line args" |
474 (string :tag "Arg")) | 482 (string :tag "Arg")) |
475 (choice :tag "Extended character mode" | 483 (choice :tag "Extended character mode" |
476 (const "~tex") (const "~plaintex") | 484 (const "~tex") (const "~plaintex") |
477 (const "~nroff") (const "~list") | 485 (const "~nroff") (const "~list") |
478 (const "~latin1") (const "~latin3") | 486 (const "~latin1") (const "~latin3") |
479 (const :tag "default" nil)) | 487 (const :tag "default" nil)) |
480 (choice :tag "Character set" | 488 (choice :tag "Character set" |
481 (const iso-8859-1) | 489 (const iso-8859-1) |
482 (const iso-8859-2) | 490 (const iso-8859-2) |
483 (const koi8-r)))) | 491 (const koi8-r)))) |
501 ("british" ; British version | 509 ("british" ; British version |
502 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "british") nil iso-8859-1) | 510 "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "british") nil iso-8859-1) |
503 ("castellano" ; Spanish mode | 511 ("castellano" ; Spanish mode |
504 "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" | 512 "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" |
505 "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" | 513 "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" |
506 "[---]" nil ("-B" "-d" "castellano") "~tex" iso-8859-1) | 514 "[-]" nil ("-B" "-d" "castellano") "~tex" iso-8859-1) |
507 ("castellano8" ; 8 bit Spanish mode | 515 ("castellano8" ; 8 bit Spanish mode |
508 "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" | 516 "[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" |
509 "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" | 517 "[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]" |
510 "[---]" nil ("-B" "-d" "castellano") "~latin1" iso-8859-1))) | 518 "[-]" nil ("-B" "-d" "castellano") "~latin1" iso-8859-1))) |
511 | 519 |
512 | 520 |
513 ;;; Second part of dictionary, shortened for loaddefs.el | 521 ;;; Second part of dictionary, shortened for loaddefs.el |
514 ;;;###autoload | 522 ;;;###autoload |
515 (setq | 523 (setq |
545 ("francais7" | 553 ("francais7" |
546 "[A-Za-z]" "[^A-Za-z]" "[`'^---]" t nil nil iso-8859-1) | 554 "[A-Za-z]" "[^A-Za-z]" "[`'^---]" t nil nil iso-8859-1) |
547 ("francais" ; Francais.aff | 555 ("francais" ; Francais.aff |
548 "[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]" | 556 "[A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]" |
549 "[^A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]" | 557 "[^A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]" |
550 "[---']" t nil "~list" iso-8859-1))) | 558 "[-']" t nil "~list" iso-8859-1))) |
551 | 559 |
552 | 560 |
553 ;;; Fourth part of dictionary, shortened for loaddefs.el | 561 ;;; Fourth part of dictionary, shortened for loaddefs.el |
554 ;;;###autoload | 562 ;;;###autoload |
555 (setq | 563 (setq |
556 ispell-dictionary-alist-4 | 564 ispell-dictionary-alist-4 |
557 '(("francais-tex" ; Francais.aff | 565 '(("francais-tex" ; Francais.aff |
558 "[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\\]" | 566 "[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\\]" |
559 "[^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\\]" | 567 "[^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\\]" |
560 "[---'^`\"]" t nil "~tex" iso-8859-1) | 568 "[-'^`\"]" t nil "~tex" iso-8859-1) |
569 ("italiano" ; Italian.aff | |
570 "[A-Z\300\301\310\311\314\315\322\323\331\332a-z\340\341\350\351\354\355\363\371\372]" | |
571 "[^A-Z\300\301\310\311\314\315\322\323\331\332a-z\340\341\350\351\354\355\363\371\372]" | |
572 "[-]" nil ("-B" "-d" "italian") "~tex" iso-8859-1) | |
561 ("nederlands" ; Nederlands.aff | 573 ("nederlands" ; Nederlands.aff |
562 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" | 574 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" |
563 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" | 575 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" |
564 "[']" t ("-C") nil iso-8859-1) | 576 "[']" t ("-C") nil iso-8859-1) |
565 ("nederlands8" ; Dutch8.aff | 577 ("nederlands8" ; Dutch8.aff |
577 "[^A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]" | 589 "[^A-Za-z\305\306\307\310\311\322\324\330\345\346\347\350\351\362\364\370]" |
578 "[\"]" nil ("-d" "norsk") "~list" iso-8859-1) | 590 "[\"]" nil ("-d" "norsk") "~list" iso-8859-1) |
579 ("norsk7-tex" ; 7 bit Norwegian TeX mode | 591 ("norsk7-tex" ; 7 bit Norwegian TeX mode |
580 "[A-Za-z{}\\'^`]" "[^A-Za-z{}\\'^`]" | 592 "[A-Za-z{}\\'^`]" "[^A-Za-z{}\\'^`]" |
581 "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1) | 593 "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1) |
582 ("polish" ; polish mode | 594 ("polish" ; polish mode |
583 "[A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" | 595 "[A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" |
584 "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" | 596 "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]" |
585 "" nil ( "-d" "polish") nil iso-8859-2))) | 597 "" nil ( "-d" "polish") nil iso-8859-2))) |
586 | 598 |
587 | 599 |
664 (repeat :tag "Ispell command line args" | 676 (repeat :tag "Ispell command line args" |
665 (string :tag "Arg")) | 677 (string :tag "Arg")) |
666 (choice :tag "Extended character mode" | 678 (choice :tag "Extended character mode" |
667 (const "~tex") (const "~plaintex") | 679 (const "~tex") (const "~plaintex") |
668 (const "~nroff") (const "~list") | 680 (const "~nroff") (const "~list") |
669 (const "~latin1") (const "~latin3") | 681 (const "~latin1") (const "~latin3") |
670 (const :tag "default" nil)) | 682 (const :tag "default" nil)) |
671 (choice :tag "Character set" | 683 (choice :tag "Character set" |
672 (const iso-8859-1) | 684 (const iso-8859-1) |
673 (const iso-8859-2) | 685 (const iso-8859-2) |
674 (const koi8-r)))) | 686 (const koi8-r)))) |
695 (defconst ispell-required-version '(3 1 12) | 707 (defconst ispell-required-version '(3 1 12) |
696 "Ispell versions with which this version of ispell.el is known to work.") | 708 "Ispell versions with which this version of ispell.el is known to work.") |
697 (defvar ispell-offset -1 | 709 (defvar ispell-offset -1 |
698 "Offset that maps protocol differences between ispell 3.1 versions.") | 710 "Offset that maps protocol differences between ispell 3.1 versions.") |
699 | 711 |
700 (defconst ispell-version "ispell.el 3.4 beta -- Fri Jan 28 17:16:58 PST 2000") | 712 (defconst ispell-version "ispell.el 3.4 -- Fri Aug 4 09:41:50 PDT 2000") |
701 | 713 |
702 | 714 |
703 (defun check-ispell-version (&optional interactivep) | 715 (defun check-ispell-version (&optional interactivep) |
704 "Ensure that `ispell-program-name' is valid and the correct version. | 716 "Ensure that `ispell-program-name' is valid and the correct version. |
705 Returns version number if called interactively. | 717 Returns version number if called interactively. |
794 'reload)) | 806 'reload)) |
795 | 807 |
796 (defvar ispell-library-path (check-ispell-version) | 808 (defvar ispell-library-path (check-ispell-version) |
797 "The directory where ispell dictionaries reside.") | 809 "The directory where ispell dictionaries reside.") |
798 | 810 |
811 (defvar ispell-process nil | |
812 "The process object for Ispell.") | |
813 | |
814 (defvar ispell-async-processp (and (fboundp 'kill-process) | |
815 (fboundp 'process-send-string) | |
816 (fboundp 'accept-process-output) | |
817 ;;(fboundp 'start-process) | |
818 ;;(fboundp 'set-process-filter) | |
819 ;;(fboundp 'process-kill-without-query) | |
820 ) | |
821 "Non-nil means that the OS supports asynchronous processes.") | |
799 | 822 |
800 ;;;###autoload | 823 ;;;###autoload |
801 (if ispell-menu-map-needed | 824 (if ispell-menu-map-needed |
802 (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist))) | 825 (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist))) |
803 ;; `ispell-library-path' intentionally not defined in autoload | 826 ;; `ispell-library-path' intentionally not defined in autoload |
813 (define-key ispell-menu-map (vector 'default) | 836 (define-key ispell-menu-map (vector 'default) |
814 (cons "Select Default Dict" | 837 (cons "Select Default Dict" |
815 (cons "Dictionary for which Ispell was configured" | 838 (cons "Dictionary for which Ispell was configured" |
816 (list 'lambda () '(interactive) | 839 (list 'lambda () '(interactive) |
817 (list | 840 (list |
818 'ispell-change-dictionary "default")))))) | 841 'ispell-change-dictionary "default")))))) |
819 ((or (not path) ; load all if library dir not defined | 842 ((or (not path) ; load all if library dir not defined |
820 (file-exists-p (concat path "/" name ".hash")) | 843 (file-exists-p (concat path "/" name ".hash")) |
821 (file-exists-p (concat path "/" name ".has")) | 844 (file-exists-p (concat path "/" name ".has")) |
822 (and load-dict | 845 (and load-dict |
823 (or (file-exists-p(concat path "/" load-dict ".hash")) | 846 (or (file-exists-p(concat path "/" load-dict ".hash")) |
835 (define-key ispell-menu-map [ispell-change-dictionary] | 858 (define-key ispell-menu-map [ispell-change-dictionary] |
836 '(menu-item "Change Dictionary..." ispell-change-dictionary | 859 '(menu-item "Change Dictionary..." ispell-change-dictionary |
837 :help "Supply explicit path to dictionary")) | 860 :help "Supply explicit path to dictionary")) |
838 (define-key ispell-menu-map [ispell-kill-ispell] | 861 (define-key ispell-menu-map [ispell-kill-ispell] |
839 '(menu-item "Kill Process" ispell-kill-ispell | 862 '(menu-item "Kill Process" ispell-kill-ispell |
840 :enable (and (boundp 'ispell-process) ispell-process | 863 :enable (and ispell-process |
841 (eq (ispell-process-status) 'run)) | 864 (eq (ispell-process-status) 'run)) |
842 :help "Terminate Ispell subprocess")) | 865 :help "Terminate Ispell subprocess")) |
843 (define-key ispell-menu-map [ispell-pdict-save] | 866 (define-key ispell-menu-map [ispell-pdict-save] |
844 '(menu-item "Save Dictionary" | 867 '(menu-item "Save Dictionary" |
845 (lambda ()(interactive) (ispell-pdict-save t t)) | 868 (lambda () (interactive) (ispell-pdict-save t t)) |
846 :help "Save personal dictionary")) | 869 :help "Save personal dictionary")) |
847 (define-key ispell-menu-map [ispell-help] | 870 (define-key ispell-menu-map [ispell-help] |
848 ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ? | 871 ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ? |
849 '(menu-item | 872 '(menu-item "Help" |
850 "Help" | 873 (lambda () (interactive) (describe-function 'ispell-help)) |
851 (lambda () (interactive) (describe-function 'ispell-help)) | 874 :help "Show standard Ispell keybindings and commands")) |
852 :help "Show standard Ispell keybindings and commands")) | |
853 (define-key ispell-menu-map [ispell-complete-word] | 875 (define-key ispell-menu-map [ispell-complete-word] |
854 '(menu-item "Complete Word" ispell-complete-word | 876 '(menu-item "Complete Word" ispell-complete-word |
855 :help "Complete word at cursor using dictionary")) | 877 :help "Complete word at cursor using dictionary")) |
856 (define-key ispell-menu-map [ispell-complete-word-interior-frag] | 878 (define-key ispell-menu-map [ispell-complete-word-interior-frag] |
857 '(menu-item "Complete Word Fragment" ispell-complete-word-interior-frag | 879 '(menu-item "Complete Word Fragment" ispell-complete-word-interior-frag |
863 (define-key ispell-menu-map [ispell-continue] | 885 (define-key ispell-menu-map [ispell-continue] |
864 '(menu-item "Continue Spell-Checking" ispell-continue | 886 '(menu-item "Continue Spell-Checking" ispell-continue |
865 :enable (and (boundp 'ispell-region-end) | 887 :enable (and (boundp 'ispell-region-end) |
866 (marker-position ispell-region-end) | 888 (marker-position ispell-region-end) |
867 (equal (marker-buffer ispell-region-end) | 889 (equal (marker-buffer ispell-region-end) |
868 (current-buffer))))) | 890 (current-buffer))) |
891 :help "Continue spell checking last region")) | |
869 (define-key ispell-menu-map [ispell-word] | 892 (define-key ispell-menu-map [ispell-word] |
870 '(menu-item "Spell-Check Word" ispell-word | 893 '(menu-item "Spell-Check Word" ispell-word |
871 :help "Spell-check word at cursor")) | 894 :help "Spell-check word at cursor")) |
872 (define-key ispell-menu-map [ispell-comments-and-strings] | 895 (define-key ispell-menu-map [ispell-comments-and-strings] |
873 '(menu-item "Spell-Check Comments" ispell-comments-and-strings | 896 '(menu-item "Spell-Check Comments" ispell-comments-and-strings |
882 :help "Spell-check text in marked region")) | 905 :help "Spell-check text in marked region")) |
883 (define-key ispell-menu-map [ispell-message] | 906 (define-key ispell-menu-map [ispell-message] |
884 '(menu-item "Spell-Check Message" ispell-message | 907 '(menu-item "Spell-Check Message" ispell-message |
885 :help "Skip headers and included message text")) | 908 :help "Skip headers and included message text")) |
886 (define-key ispell-menu-map [ispell-buffer] | 909 (define-key ispell-menu-map [ispell-buffer] |
887 '(menu-item "Spell-Check Buffer" ispell-buffer)) | 910 '(menu-item "Spell-Check Buffer" ispell-buffer |
911 :help "Check spelling of selected buffer")) | |
912 ;;(put 'ispell-region 'menu-enable 'mark-active) | |
888 (fset 'ispell-menu-map (symbol-value 'ispell-menu-map)))) | 913 (fset 'ispell-menu-map (symbol-value 'ispell-menu-map)))) |
889 | 914 |
890 ;;; XEmacs versions 19 & 20 | 915 ;;; XEmacs versions 19 & 20 |
891 (if (and xemacsp | 916 (if (and xemacsp |
892 (not version18p) | 917 (not version18p) |
987 (defun ispell-get-extended-character-mode () | 1012 (defun ispell-get-extended-character-mode () |
988 (nth 6 (assoc ispell-dictionary ispell-dictionary-alist))) | 1013 (nth 6 (assoc ispell-dictionary ispell-dictionary-alist))) |
989 (defun ispell-get-coding-system () | 1014 (defun ispell-get-coding-system () |
990 (nth 7 (assoc ispell-dictionary ispell-dictionary-alist))) | 1015 (nth 7 (assoc ispell-dictionary ispell-dictionary-alist))) |
991 | 1016 |
992 (defvar ispell-process nil | |
993 "The process object for Ispell.") | |
994 | |
995 (defvar ispell-async-processp (and (fboundp 'kill-process) | |
996 (fboundp 'process-send-string) | |
997 (fboundp 'accept-process-output) | |
998 ;;(fboundp 'start-process) | |
999 ;;(fboundp 'set-process-filter) | |
1000 ;;(fboundp 'process-kill-without-query) | |
1001 ) | |
1002 "Non-nil means that the OS supports asynchronous processes.") | |
1003 | 1017 |
1004 (defvar ispell-pdict-modified-p nil | 1018 (defvar ispell-pdict-modified-p nil |
1005 "Non-nil means personal dictionary has modifications to be saved.") | 1019 "Non-nil means personal dictionary has modifications to be saved.") |
1006 | 1020 |
1007 ;;; If you want to save the dictionary when quitting, must do so explicitly. | 1021 ;;; If you want to save the dictionary when quitting, must do so explicitly. |
1073 (ispell-dictionary-keyword forward-line) | 1087 (ispell-dictionary-keyword forward-line) |
1074 (ispell-pdict-keyword forward-line) | 1088 (ispell-pdict-keyword forward-line) |
1075 (ispell-parsing-keyword forward-line) | 1089 (ispell-parsing-keyword forward-line) |
1076 ("^---*BEGIN PGP [A-Z ]*--*" . "^---*END PGP [A-Z ]*--*") | 1090 ("^---*BEGIN PGP [A-Z ]*--*" . "^---*END PGP [A-Z ]*--*") |
1077 ("^---* \\(Start of \\)?[Ff]orwarded [Mm]essage" . "^---* End of [Ff]orwarded [Mm]essage") | 1091 ("^---* \\(Start of \\)?[Ff]orwarded [Mm]essage" . "^---* End of [Ff]orwarded [Mm]essage") |
1078 ;; matches e-mail addresses, file names, http addresses, etc. | 1092 ;; Matches e-mail addresses, file names, http addresses, etc. The `-+' |
1079 ("\\(/\\|\\(\\(\\w\\|-\\)+[.:@]\\)\\)\\(\\w\\|-\\)*\\([.:/@]+\\(\\w\\|-\\|~\\)+\\)+") | 1093 ;; pattern necessary for performance reasons when `-' part of word syntax. |
1094 ("\\(-+\\|\\(/\\|\\(\\(\\w\\|[-_]\\)+[.:@]\\)\\)\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_]\\|~\\)+\\)+\\)") | |
1080 ;; This is a pretty complex regexp. It can be simplified to the following: | 1095 ;; This is a pretty complex regexp. It can be simplified to the following: |
1081 ;; "\\(\\w\\|-\\)*\\([.:/@]+\\(\\w\\|-\\|~\\)+\\)+" | 1096 ;; "\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_]\\|~\\)+\\)+" |
1082 ;; but some valid text will be skipped, e.g. "his/her". This could be | 1097 ;; but some valid text will be skipped, e.g. "his/her". This could be |
1083 ;; fixed up (at the expense of a moderately more complex regexp) | 1098 ;; fixed up (at the expense of a moderately more complex regexp) |
1084 ;; by not allowing "/" to be the character which triggers the | 1099 ;; by not allowing "/" to be the character which triggers the |
1085 ;; identification of the computer name, e.g.: | 1100 ;; identification of the computer name, e.g.: |
1086 ;; "\\(\\w\\|-\\)+[.:@]\\(\\w\\|-\\)*\\([.:/@]+\\(\\w\\|-\\|~\\)+\\)+" | 1101 ;; "\\(\\w\\|[-_]\\)+[.:@]\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_]\\|~\\)+\\)+" |
1087 ) | 1102 ) |
1088 "Alist expressing beginning and end of regions not to spell check. | 1103 "Alist expressing beginning and end of regions not to spell check. |
1089 The alist key must be a regular expression. | 1104 The alist key must be a regular expression. |
1090 Valid forms include: | 1105 Valid forms include: |
1091 (KEY) - just skip the key. | 1106 (KEY) - just skip the key. |
1105 ("\\\\add\\(tocontents\\|vspace\\)" ispell-tex-arg-end) | 1120 ("\\\\add\\(tocontents\\|vspace\\)" ispell-tex-arg-end) |
1106 ("\\\\\\([aA]lph\\|arabic\\)" ispell-tex-arg-end) | 1121 ("\\\\\\([aA]lph\\|arabic\\)" ispell-tex-arg-end) |
1107 ;;("\\\\author" ispell-tex-arg-end) | 1122 ;;("\\\\author" ispell-tex-arg-end) |
1108 ("\\\\bibliographystyle" ispell-tex-arg-end) | 1123 ("\\\\bibliographystyle" ispell-tex-arg-end) |
1109 ("\\\\makebox" ispell-tex-arg-end 0) | 1124 ("\\\\makebox" ispell-tex-arg-end 0) |
1110 ;;("\\\\epsfig" ispell-tex-arg-end) | 1125 ("\\\\e?psfig" ispell-tex-arg-end) |
1111 ("\\\\document\\(class\\|style\\)" . | 1126 ("\\\\document\\(class\\|style\\)" . |
1112 "\\\\begin[ \t\n]*{[ \t\n]*document[ \t\n]*}")) | 1127 "\\\\begin[ \t\n]*{[ \t\n]*document[ \t\n]*}")) |
1113 (;; delimited with \begin. In ispell: displaymath, eqnarray, eqnarray*, | 1128 (;; delimited with \begin. In ispell: displaymath, eqnarray, eqnarray*, |
1114 ;; equation, minipage, picture, tabular, tabular* (ispell) | 1129 ;; equation, minipage, picture, tabular, tabular* (ispell) |
1115 ("\\(figure\\|table\\)\\*?" ispell-tex-arg-end 0) | 1130 ("\\(figure\\|table\\)\\*?" ispell-tex-arg-end 0) |
1116 ("list" ispell-tex-arg-end 2) | 1131 ("list" ispell-tex-arg-end 2) |
1117 ("program" . "\\\\end[ \t\n]*{[ \t\n]*program[ \t\n]*}") | 1132 ("program" . "\\\\end[ \t\n]*{[ \t\n]*program[ \t\n]*}") |
1118 ("verbatim\\*?" . "\\\\end[ \t\n]*{[ \t\n]*verbatim\\*?[ \t\n]*}"))) | 1133 ("verbatim\\*?" . "\\\\end[ \t\n]*{[ \t\n]*verbatim\\*?[ \t\n]*}"))) |
1119 "*Lists of regions to be skipped in TeX mode. | 1134 "*Lists of regions to be skipped in TeX mode. |
1120 First list is used raw. | 1135 First list is used raw. |
1121 Second list has key placed inside \\begin{}. | 1136 Second list has key placed inside \\begin{}. |
1527 (setq count (ispell-int-char (- count ?0 skipped)))) | 1542 (setq count (ispell-int-char (- count ?0 skipped)))) |
1528 | 1543 |
1529 ;; ensure word is visible | 1544 ;; ensure word is visible |
1530 (if (not (pos-visible-in-window-p end)) | 1545 (if (not (pos-visible-in-window-p end)) |
1531 (sit-for 0)) | 1546 (sit-for 0)) |
1532 | 1547 |
1533 ;; allow temporary split of dedicated windows... | 1548 ;; allow temporary split of dedicated windows... |
1534 (if dedicated | 1549 (if dedicated |
1535 (progn | 1550 (progn |
1536 (setq dedicated-win (selected-window)) | 1551 (setq dedicated-win (selected-window)) |
1537 (set-window-dedicated-p dedicated-win nil))) | 1552 (set-window-dedicated-p dedicated-win nil))) |
1794 `C-z': suspend emacs or iconify frame" | 1809 `C-z': suspend emacs or iconify frame" |
1795 | 1810 |
1796 (if (equal ispell-help-in-bufferp 'electric) | 1811 (if (equal ispell-help-in-bufferp 'electric) |
1797 (progn | 1812 (progn |
1798 (require 'ehelp) | 1813 (require 'ehelp) |
1799 (with-electric-help | 1814 (with-electric-help |
1800 (function (lambda () | 1815 (function (lambda () |
1801 ;;This shouldn't be necessary: with-electric-help needs | 1816 ;;This shouldn't be necessary: with-electric-help needs |
1802 ;; an optional argument telling it about the smallest | 1817 ;; an optional argument telling it about the smallest |
1803 ;; acceptable window-height of the help buffer. | 1818 ;; acceptable window-height of the help buffer. |
1804 (if (< (window-height) 15) | 1819 (if (< (window-height) 15) |
2142 | 2157 |
2143 (defun ispell-init-process () | 2158 (defun ispell-init-process () |
2144 "Check status of Ispell process and start if necessary." | 2159 "Check status of Ispell process and start if necessary." |
2145 (if (and ispell-process | 2160 (if (and ispell-process |
2146 (eq (ispell-process-status) 'run) | 2161 (eq (ispell-process-status) 'run) |
2147 ;; If we're using a personal dictionary, assure | 2162 ;; If we're using a personal dictionary, ensure |
2148 ;; we're in the same default directory! | 2163 ;; we're in the same default directory! |
2149 (or (not ispell-personal-dictionary) | 2164 (or (not ispell-personal-dictionary) |
2150 (equal ispell-process-directory default-directory))) | 2165 (equal ispell-process-directory default-directory))) |
2151 (setq ispell-filter nil ispell-filter-continue nil) | 2166 (setq ispell-filter nil ispell-filter-continue nil) |
2152 ;; may need to restart to select new personal dictionary. | 2167 ;; may need to restart to select new personal dictionary. |
2394 (setq skip-regexp (concat (if (string= "" comment-end) "^" | 2409 (setq skip-regexp (concat (if (string= "" comment-end) "^" |
2395 (regexp-quote comment-end)) | 2410 (regexp-quote comment-end)) |
2396 "\\|" skip-regexp))) | 2411 "\\|" skip-regexp))) |
2397 (if ispell-skip-tib | 2412 (if ispell-skip-tib |
2398 (setq skip-regexp (concat ispell-tib-ref-beginning "\\|" skip-regexp))) | 2413 (setq skip-regexp (concat ispell-tib-ref-beginning "\\|" skip-regexp))) |
2399 (if ispell-skip-sgml | 2414 (if ispell-skip-html |
2400 (setq skip-regexp (concat "<author>" "\\|" | 2415 (setq skip-regexp (concat "<[cC][oO][dD][eE]\\>[^>]*>" "\\|" |
2401 "<[cC][oO][dD][eE]>" "\\|" | 2416 "<[sS][cC][rR][iI][pP][tT]\\>[^>]*>" "\\|" |
2402 "<[vV][eE][rR][bB]>" "\\|" | 2417 "<[aA][pP][pP][lL][eE][tT]\\>[^>]*>" "\\|" |
2403 ;; "<[tT][tT]>" "\\|" | 2418 "<[vV][eE][rR][bB]\\>[^>]*>" "\\|" |
2419 ;; "<[tT][tT]\\>[^>]*>" "\\|" | |
2404 "<[tT][tT]/" "\\|" | 2420 "<[tT][tT]/" "\\|" |
2405 "</" "\\|" | |
2406 "<" "\\|" | 2421 "<" "\\|" |
2407 "&" "\\|" | 2422 "&" "\\|" |
2408 skip-regexp))) | 2423 skip-regexp))) |
2409 (if (eq ispell-parser 'tex) | 2424 (if (eq ispell-parser 'tex) |
2410 (setq skip-regexp (concat (ispell-begin-tex-skip-regexp) "\\|" | 2425 (setq skip-regexp (concat (ispell-begin-tex-skip-regexp) "\\|" |
2466 ((and (eq 'exclusive ispell-check-comments) comment-start | 2481 ((and (eq 'exclusive ispell-check-comments) comment-start |
2467 (string= key comment-end)) | 2482 (string= key comment-end)) |
2468 (search-forward comment-start ispell-region-end :end)) | 2483 (search-forward comment-start ispell-region-end :end)) |
2469 ((and ispell-skip-tib (string-match ispell-tib-ref-beginning key)) | 2484 ((and ispell-skip-tib (string-match ispell-tib-ref-beginning key)) |
2470 (re-search-forward ispell-tib-ref-end ispell-region-end t)) | 2485 (re-search-forward ispell-tib-ref-end ispell-region-end t)) |
2471 ((and ispell-skip-sgml (string-match "<author>" key)) | 2486 ((and ispell-skip-html (string-match "</" key)) |
2472 (search-forward-regexp ".$" ispell-region-end t)) | |
2473 ((and ispell-skip-sgml (string-match "</" key)) | |
2474 (search-forward ">" ispell-region-end t)) | 2487 (search-forward ">" ispell-region-end t)) |
2475 ((and ispell-skip-sgml (string-match "<[cC][oO][dD][eE]>" key)) | 2488 ((and ispell-skip-html (string-match "<[cC][oO][dD][eE]\\>[^>]*>" key)) |
2476 (search-forward-regexp "</[cC][oO][dD][eE]>" ispell-region-end t)) | 2489 (search-forward-regexp "</[cC][oO][dD][eE]>" ispell-region-end t)) |
2477 ((and ispell-skip-sgml (string-match "<[vV][eE][rR][bB]>" key)) | 2490 ((and ispell-skip-html |
2491 (string-match "<[sS][cC][rR][iI][pP][tT]\\>[^>]*>" key)) | |
2492 (search-forward-regexp "</[sS][cC][rR][iI][pP][tT]>" ispell-region-end t)) | |
2493 ((and ispell-skip-html | |
2494 (string-match "<[aA][pP][pP][lL][eE][tT]\\>[^>]*>" key)) | |
2495 (search-forward-regexp "</[aA][pP][pP][lL][eE][tT]>" ispell-region-end t)) | |
2496 ((and ispell-skip-html (string-match "<[vV][eE][rR][bB]\\>[^>]*>" key)) | |
2478 (search-forward-regexp "</[vV][eE][rR][bB]>" ispell-region-end t)) | 2497 (search-forward-regexp "</[vV][eE][rR][bB]>" ispell-region-end t)) |
2479 ;;((and ispell-skip-sgml (string-match "<[tT][tT]>" key)) | 2498 ;;((and ispell-skip-html (string-match "<[tT][tT]\\>[^>]*>" key)) |
2480 ;; (search-forward-regexp "</[tT][tT]>" ispell-region-end t)) | 2499 ;; (search-forward-regexp "</[tT][tT]>" ispell-region-end t)) |
2481 ((and ispell-skip-sgml (string-match "<[tT][tT]/" key)) | 2500 ((and ispell-skip-html (string-match "<[tT][tT]/" key)) |
2482 (search-forward "/" ispell-region-end t)) | 2501 (search-forward "/" ispell-region-end t)) |
2483 ((and ispell-skip-sgml (string-match "<" key)) | 2502 ((and ispell-skip-html (string-match "<" key)) |
2484 (search-forward-regexp "[/>]" ispell-region-end t)) | 2503 (search-forward ">" ispell-region-end t)) |
2485 ((and ispell-skip-sgml (string-match "&" key)) | 2504 ((and ispell-skip-html (string-match "&" key)) |
2486 (search-forward ";" ispell-region-end t)) | 2505 (search-forward-regexp "[; \t\n]" ispell-region-end t)) |
2487 ;; markings from alist | 2506 ;; markings from alist |
2488 (t | 2507 (t |
2489 (while alist | 2508 (while alist |
2490 (setq alist-key (eval (car (car alist)))) | 2509 (setq alist-key (eval (car (car alist)))) |
2491 (if (string-match alist-key key) | 2510 (if (string-match alist-key key) |
2519 (let ((ispell-casechars (ispell-get-casechars)) | 2538 (let ((ispell-casechars (ispell-get-casechars)) |
2520 string) | 2539 string) |
2521 (cond ; LOOK AT THIS LINE AND SKIP OR PROCESS | 2540 (cond ; LOOK AT THIS LINE AND SKIP OR PROCESS |
2522 ((eolp) ; END OF LINE, just go to next line. | 2541 ((eolp) ; END OF LINE, just go to next line. |
2523 (forward-line)) | 2542 (forward-line)) |
2524 ;;((looking-at "[---#@*+!%~^]") ; SKIP SPECIAL ISPELL CHARACTERS | 2543 ;;((looking-at "[-#@*+!%~^]") ; SKIP SPECIAL ISPELL CHARACTERS |
2525 ;; (forward-char 1)) ; not needed as quoted below. | 2544 ;; (forward-char 1)) ; not needed as quoted below. |
2526 ((or (re-search-forward ispell-casechars end t) ; TEXT EXISTS | 2545 ((or (re-search-forward ispell-casechars end t) ; TEXT EXISTS |
2527 (re-search-forward "[][()${}]" end t)) ; or MATH COMMANDS | 2546 (re-search-forward "[][()${}]" end t)) ; or MATH COMMANDS |
2528 (setq string (concat "^" (buffer-substring-no-properties start end) | 2547 (setq string (concat "^" (buffer-substring-no-properties start end) |
2529 "\n")) | 2548 "\n")) |
2530 (goto-char end)) | 2549 (goto-char end)) |
2531 (t (goto-char end))) ; EMPTY LINE, skip it. | 2550 (t (goto-char end))) ; EMPTY LINE, skip it. |
2532 string)) | 2551 string)) |
2533 | 2552 |
2553 | |
2554 ;;; Avoid error messages when compiling for these dynamic variables. | |
2555 (eval-when-compile | |
2556 (defvar start) | |
2557 (defvar end)) | |
2534 | 2558 |
2535 (defun ispell-process-line (string shift) | 2559 (defun ispell-process-line (string shift) |
2536 "Sends a LINE of text to ispell and processes the result. | 2560 "Sends a LINE of text to ispell and processes the result. |
2537 This will modify the buffer for spelling errors. | 2561 This will modify the buffer for spelling errors. |
2538 Requires variables START and END to be defined in its lexical scope. | 2562 Requires variables START and END to be defined in its lexical scope. |
2642 (setq accept-list (cons replace-word accept-list) | 2666 (setq accept-list (cons replace-word accept-list) |
2643 replace replace-word) | 2667 replace replace-word) |
2644 (let ((region-end (copy-marker ispell-region-end))) | 2668 (let ((region-end (copy-marker ispell-region-end))) |
2645 (setq recheck-region ispell-filter | 2669 (setq recheck-region ispell-filter |
2646 ispell-filter nil ; save filter | 2670 ispell-filter nil ; save filter |
2671 shift 0 ; already accounted | |
2647 shift (ispell-region | 2672 shift (ispell-region |
2648 word-start | 2673 word-start |
2649 (+ word-start (length replace-word)) | 2674 (+ word-start (length replace-word)) |
2650 t shift)) | 2675 t shift)) |
2651 (if (null shift) ; quitting check. | 2676 (if (null shift) ; quitting check. |
2652 (setq shift 0)) | 2677 (setq shift 0)) |
2653 (set-marker ispell-region-end region-end) | 2678 (set-marker ispell-region-end region-end) |
2654 (set-marker region-end nil) | 2679 (set-marker region-end nil) |
2655 (setq ispell-filter recheck-region | 2680 (setq ispell-filter recheck-region |
2812 | 2837 |
2813 | 2838 |
2814 ;;;###autoload | 2839 ;;;###autoload |
2815 (defun ispell () | 2840 (defun ispell () |
2816 "Interactively check a region or buffer for spelling errors. | 2841 "Interactively check a region or buffer for spelling errors. |
2817 If `transient-mark-mode' is on, an a region is active, spell-check | 2842 If `transient-mark-mode' is on, and a region is active, spell-check |
2818 that region. Otherwise spell-check the buffer." | 2843 that region. Otherwise spell-check the buffer." |
2819 (interactive) | 2844 (interactive) |
2820 (if (and transient-mark-mode mark-active) | 2845 (if (and transient-mark-mode mark-active) |
2821 (ispell-region (region-beginning) (region-end)) | 2846 (ispell-region (region-beginning) (region-end)) |
2822 (ispell-buffer))) | 2847 (ispell-buffer))) |
2850 | 2875 |
2851 ;;;###autoload | 2876 ;;;###autoload |
2852 (defun ispell-minor-mode (&optional arg) | 2877 (defun ispell-minor-mode (&optional arg) |
2853 "Toggle Ispell minor mode. | 2878 "Toggle Ispell minor mode. |
2854 With prefix arg, turn Ispell minor mode on iff arg is positive. | 2879 With prefix arg, turn Ispell minor mode on iff arg is positive. |
2855 | 2880 |
2856 In Ispell minor mode, pressing SPC or RET | 2881 In Ispell minor mode, pressing SPC or RET |
2857 warns you if the previous word is incorrectly spelled. | 2882 warns you if the previous word is incorrectly spelled. |
2858 | 2883 |
2859 All the buffer-local variables and dictionaries are ignored -- to read | 2884 All the buffer-local variables and dictionaries are ignored -- to read |
2860 them into the running ispell process, type \\[ispell-word] SPC." | 2885 them into the running ispell process, type \\[ispell-word] SPC." |
2861 (interactive "P") | 2886 (interactive "P") |
2862 (setq ispell-minor-mode | 2887 (setq ispell-minor-mode |
2863 (not (or (and (null arg) ispell-minor-mode) | 2888 (not (or (and (null arg) ispell-minor-mode) |
2864 (<= (prefix-numeric-value arg) 0)))) | 2889 (<= (prefix-numeric-value arg) 0)))) |
2865 (force-mode-line-update)) | 2890 (force-mode-line-update)) |
2866 | 2891 |
2867 (defun ispell-minor-check () | 2892 (defun ispell-minor-check () |
2868 "Check previous word then continue with the normal binding of this key. | 2893 "Check previous word then continue with the normal binding of this key. |
2869 Don't check previous word when character before point is a space or newline. | 2894 Don't check previous word when character before point is a space or newline. |
2870 Don't read buffer-local settings or word lists." | 2895 Don't read buffer-local settings or word lists." |
2871 (interactive "*") | 2896 (interactive "*") |
2872 (let ((ispell-minor-mode nil) | 2897 (let ((ispell-minor-mode nil) |
2873 (ispell-check-only t) | 2898 (ispell-check-only t) |
2874 (last-char (char-after (1- (point))))) | 2899 (last-char (char-after (1- (point))))) |
2875 (command-execute (key-binding (this-command-keys))) | 2900 (command-execute (key-binding (this-command-keys))) |
2876 (if (not (or (eq last-char ?\ ) (eq last-char ?\n) | 2901 (if (not (or (eq last-char ?\ ) (eq last-char ?\n) |
2877 (and ispell-skip-sgml (eq last-char ?>)) | 2902 (and ispell-skip-html (eq last-char ?>)) |
2878 (and ispell-skip-sgml (eq last-char ?\;)))) | 2903 (and ispell-skip-html (eq last-char ?\;)))) |
2879 (ispell-word nil t)))) | 2904 (ispell-word nil t)))) |
2880 | 2905 |
2881 | 2906 |
2882 ;;; ********************************************************************** | 2907 ;;; ********************************************************************** |
2883 ;;; Ispell Message | 2908 ;;; Ispell Message |
3061 (ispell-send-string "+\n") ; set ispell mode to tex | 3086 (ispell-send-string "+\n") ; set ispell mode to tex |
3062 (if (not (eq ispell-parser 'tex)) | 3087 (if (not (eq ispell-parser 'tex)) |
3063 (set (make-local-variable 'ispell-parser) 'tex))) | 3088 (set (make-local-variable 'ispell-parser) 'tex))) |
3064 (ispell-send-string "-\n")) ; set mode to normal (nroff) | 3089 (ispell-send-string "-\n")) ; set mode to normal (nroff) |
3065 ;; If needed, test for SGML & HTML modes and set a buffer local nil/t value. | 3090 ;; If needed, test for SGML & HTML modes and set a buffer local nil/t value. |
3066 (if (and ispell-skip-sgml (not (eq ispell-skip-sgml t))) | 3091 (if (and ispell-skip-html (not (eq ispell-skip-html t))) |
3067 (set (make-local-variable 'ispell-skip-sgml) | 3092 (set (make-local-variable 'ispell-skip-html) |
3068 (not (null (string-match "sgml\\|html" | 3093 (not (null (string-match "sgml\\|html" |
3069 (downcase (symbol-name major-mode))))))) | 3094 (downcase (symbol-name major-mode))))))) |
3070 ;; Set default extended character mode for given buffer, if any. | 3095 ;; Set default extended character mode for given buffer, if any. |
3071 (let ((extended-char-mode (ispell-get-extended-character-mode))) | 3096 (let ((extended-char-mode (ispell-get-extended-character-mode))) |
3072 (if extended-char-mode | 3097 (if extended-char-mode |
3172 (or ispell-buffer-local-name | 3197 (or ispell-buffer-local-name |
3173 (setq ispell-buffer-local-name (buffer-name))) | 3198 (setq ispell-buffer-local-name (buffer-name))) |
3174 (save-excursion | 3199 (save-excursion |
3175 (goto-char (point-min)) | 3200 (goto-char (point-min)) |
3176 (let ((old-case-fold-search case-fold-search) | 3201 (let ((old-case-fold-search case-fold-search) |
3177 line-okay search done string) | 3202 line-okay search done found) |
3178 (while (not done) | 3203 (while (not done) |
3179 (setq case-fold-search nil | 3204 (setq case-fold-search nil |
3180 search (search-forward ispell-words-keyword nil 'move) | 3205 search (search-forward ispell-words-keyword nil 'move) |
3206 found (or found search) | |
3181 line-okay (< (+ (length word) 1 ; 1 for space after word.. | 3207 line-okay (< (+ (length word) 1 ; 1 for space after word.. |
3182 (progn (end-of-line) (current-column))) | 3208 (progn (end-of-line) (current-column))) |
3183 80) | 3209 80) |
3184 case-fold-search old-case-fold-search) | 3210 case-fold-search old-case-fold-search) |
3185 (if (or (and search line-okay) | 3211 (if (or (and search line-okay) |
3187 (progn | 3213 (progn |
3188 (setq done t) | 3214 (setq done t) |
3189 (if (null search) | 3215 (if (null search) |
3190 (progn | 3216 (progn |
3191 (open-line 1) | 3217 (open-line 1) |
3192 (setq string (concat comment-start " " | 3218 (unless found (newline)) |
3193 ispell-words-keyword)) | 3219 (insert (concat comment-start " " ispell-words-keyword)) |
3194 (insert string) | 3220 (if (> (length comment-end) 0) |
3195 (if (and comment-end (not (equal "" comment-end))) | |
3196 (save-excursion | 3221 (save-excursion |
3197 (open-line 1) | 3222 (newline) |
3198 (forward-line 1) | |
3199 (insert comment-end))))) | 3223 (insert comment-end))))) |
3200 (insert (concat " " word)))))))) | 3224 (insert (concat " " word)))))))) |
3201 | 3225 |
3202 (add-to-list 'debug-ignored-errors "^No word found to check!$") | 3226 (add-to-list 'debug-ignored-errors "^No word found to check!$") |
3203 | 3227 |