aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2000-08-17 20:54:01 +0000
committerGerd Moellmann2000-08-17 20:54:01 +0000
commitfea6948a28a2fa75d0b006b04276724fbc0ca07a (patch)
tree01a09a1c7f32fc08c879a8d192dcf6cd48232a70
parenta7b2852367a97fd250d41d103f893acd7db8eb6f (diff)
downloademacs-fea6948a28a2fa75d0b006b04276724fbc0ca07a.tar.gz
emacs-fea6948a28a2fa75d0b006b04276724fbc0ca07a.zip
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.
-rw-r--r--lisp/textmodes/ispell.el194
1 files changed, 109 insertions, 85 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index c888cf09981..37130fea109 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2,9 +2,10 @@
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
@@ -128,7 +129,14 @@
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
@@ -279,9 +287,9 @@ This minimizes redisplay thrashing."
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.
281Must be greater than 1. 289Must be greater than 1.
282XEmacs modeline is thicker than a line of text, so it partially covers the 290A Graphic capable modeline is thicker than a line of text, so it partially
283last line of text in the buffer. Include an extra line in XEmacs to see 291covers the last line of text in the choices buffer. Include an extra line
284all of the choices clearly." 292for graphic capable displays to see all of the choices clearly."
285 :type 'integer 293 :type 'integer
286 :group 'ispell) 294 :group 'ispell)
287 295
@@ -376,7 +384,7 @@ The following values are supported:
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)
@@ -448,7 +456,7 @@ for language-specific arguments."
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.
453If t, always skip SGML markup; if nil, never skip; if non-t and non-nil, 461If t, always skip SGML markup; if nil, never skip; if non-t and non-nil,
454guess whether SGML markup should be skipped according to the name of the 462guess whether SGML markup should be skipped according to the name of the
@@ -475,7 +483,7 @@ See `ispell-dictionary-alist'."
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)
@@ -503,11 +511,11 @@ See `ispell-dictionary-alist'."
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
@@ -547,7 +555,7 @@ See `ispell-dictionary-alist'."
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
@@ -557,7 +565,11 @@ See `ispell-dictionary-alist'."
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]"
@@ -579,7 +591,7 @@ See `ispell-dictionary-alist'."
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)))
@@ -666,7 +678,7 @@ LANGUAGE.aff file \(e.g., english.aff\)."
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)
@@ -697,7 +709,7 @@ LANGUAGE.aff file \(e.g., english.aff\)."
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)
@@ -796,6 +808,17 @@ and added as a submenu of the \"Edit\" menu.")
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
@@ -815,7 +838,7 @@ and added as a submenu of the \"Edit\" menu.")
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"))
@@ -837,19 +860,18 @@ and added as a submenu of the \"Edit\" menu.")
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"))
@@ -865,7 +887,8 @@ and added as a submenu of the \"Edit\" menu.")
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"))
@@ -884,7 +907,9 @@ and added as a submenu of the \"Edit\" menu.")
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
@@ -989,17 +1014,6 @@ Protects against bogus binding of `enable-multibyte-characters' in XEmacs."
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.")
@@ -1075,15 +1089,16 @@ The last occurring definition in the buffer will be used.")
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.
1089The alist key must be a regular expression. 1104The alist key must be a regular expression.
@@ -1107,13 +1122,13 @@ Valid forms include:
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.
@@ -1529,7 +1544,7 @@ Global `ispell-quit' set to start location to continue spell session."
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
@@ -1796,7 +1811,7 @@ SPC: Accept word this time.
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
@@ -2144,7 +2159,7 @@ Keeps argument list for future ispell invocations for no async support."
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)))
@@ -2396,13 +2411,13 @@ Return nil if spell session is quit,
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)))
@@ -2468,22 +2483,26 @@ otherwise, the current line is skipped."
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
@@ -2521,7 +2540,7 @@ otherwise, the current line is skipped."
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
@@ -2532,6 +2551,11 @@ otherwise, the current line is skipped."
2532 string)) 2551 string))
2533 2552
2534 2553
2554;;; Avoid error messages when compiling for these dynamic variables.
2555(eval-when-compile
2556 (defvar start)
2557 (defvar end))
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.
2537This will modify the buffer for spelling errors. 2561This will modify the buffer for spelling errors.
@@ -2644,10 +2668,11 @@ Returns the sum shift due to changes in word replacements."
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)
@@ -2814,7 +2839,7 @@ Standard ispell choices are then available."
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.
2817If `transient-mark-mode' is on, an a region is active, spell-check 2842If `transient-mark-mode' is on, and a region is active, spell-check
2818that region. Otherwise spell-check the buffer." 2843that 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)
@@ -2852,7 +2877,7 @@ that region. Otherwise spell-check the buffer."
2852(defun ispell-minor-mode (&optional arg) 2877(defun ispell-minor-mode (&optional arg)
2853 "Toggle Ispell minor mode. 2878 "Toggle Ispell minor mode.
2854With prefix arg, turn Ispell minor mode on iff arg is positive. 2879With prefix arg, turn Ispell minor mode on iff arg is positive.
2855 2880
2856In Ispell minor mode, pressing SPC or RET 2881In Ispell minor mode, pressing SPC or RET
2857warns you if the previous word is incorrectly spelled. 2882warns you if the previous word is incorrectly spelled.
2858 2883
@@ -2863,7 +2888,7 @@ them into the running ispell process, type \\[ispell-word] SPC."
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.
2869Don't check previous word when character before point is a space or newline. 2894Don't check previous word when character before point is a space or newline.
@@ -2874,8 +2899,8 @@ Don't read buffer-local settings or word lists."
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
@@ -3063,8 +3088,8 @@ Includes Latex/Nroff modes and extended character mode."
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.
@@ -3174,10 +3199,11 @@ Both should not be used to define a buffer-local dictionary."
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)
@@ -3189,13 +3215,11 @@ Both should not be used to define a buffer-local dictionary."
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