diff options
| author | Karl Heuer | 1999-05-09 06:34:35 +0000 |
|---|---|---|
| committer | Karl Heuer | 1999-05-09 06:34:35 +0000 |
| commit | 6fdf40f3a100b572583c3816c3074cea455aee12 (patch) | |
| tree | ee13e6cd16f6eba8f96fbba135df63ffb4dd05db | |
| parent | db4a79ae0bd8b80655167c47aeaabc81561720e0 (diff) | |
| download | emacs-6fdf40f3a100b572583c3816c3074cea455aee12.tar.gz emacs-6fdf40f3a100b572583c3816c3074cea455aee12.zip | |
(ispell-local-dictionary-alist): New variable for
customizing local dictionaries not accessable by everyone.
(ispell-dictionary-alist): Loads `ispell-local-dictionary-alist'.
(ispell-required-version): Changed format `(major minor
revision)' to support general pattern matching.
(ispell-tex-skip-alists): AMS Tex block comment and `\author'
skip region commented out due to incorrect skip potential in std latex.
(ispell-word): Removed `when' macro. Fixed bug of not restoring
cursor point on small words for calls from `ispell-minor-mode'.
(check-ispell-version): Tests and accepts versions major.minor
and above, with adjustments for interactions in 3.1.0-3.1.11.
(ispell-get-line): No longer skips ispell process special characters.
(ispell-comments-and-strings): Removed `when' macro call.
(ispell-minor-check): Requires ispell-word to restore cursor point.
(ispell-buffer-local-parsing): Supports checking comments only.
| -rw-r--r-- | lisp/textmodes/ispell.el | 230 |
1 files changed, 143 insertions, 87 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index b14f4e39d98..1b22c23e65c 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | ;;; ispell.el --- Interface to International Ispell Version 3.1 | 1 | ;;; ispell.el --- Interface to International Ispell Version 3.1 |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 1995, 1997, 1998, 1999 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Authors : Ken Stevens <k.stevens@ieee.org> | 5 | ;; Authors : Ken Stevens <k.stevens@ieee.org> |
| 6 | ;; Stevens Mod Date: Mon Nov 30 20:32:48 PST 1998 | 6 | ;; Stevens Mod Date: Fri May 7 14:25:14 PDT 1999 |
| 7 | ;; Stevens Revision: 3.1 | 7 | ;; Stevens Revision: 3.2 |
| 8 | ;; Status : Release with 3.1.12+ ispell. | 8 | ;; Status : Release with 3.1.12+ ispell. |
| 9 | ;; Bug Reports : ispell-el-bugs@itcorp.com | 9 | ;; Bug Reports : ispell-el-bugs@itcorp.com |
| 10 | ;; Web Site : http://kdstevens.com/~stevens/ispell-page.html | 10 | ;; Web Site : http://kdstevens.com/~stevens/ispell-page.html |
| @@ -33,22 +33,24 @@ | |||
| 33 | 33 | ||
| 34 | ;; INSTRUCTIONS | 34 | ;; INSTRUCTIONS |
| 35 | 35 | ||
| 36 | ;; This code contains a section of user-settable variables that you should | 36 | ;; This code contains a section of user-settable variables that you |
| 37 | ;; inspect prior to installation. Look past the end of the history list. | 37 | ;; should inspect prior to installation. Look past the end of the history |
| 38 | ;; Set them up for your locale and the preferences of the majority of the | 38 | ;; list. Set them up for your locale and the preferences of the majority |
| 39 | ;; users. Otherwise the users may need to set a number of variables | 39 | ;; of the users. Otherwise the users may need to set a number of variables |
| 40 | ;; themselves. | 40 | ;; themselves. |
| 41 | ;; You particularly may want to change the default dictionary for your | 41 | ;; You particularly may want to change the default dictionary for your |
| 42 | ;; country and language. | 42 | ;; country and language. |
| 43 | ;; Most dictionary changes should be made in this file so all users can | ||
| 44 | ;; enjoy them. Local or modified dictionaries are supported in your .emacs | ||
| 45 | ;; file. Modify the variable `ispell-local-dictionary-alist' to include | ||
| 46 | ;; these dictionaries, and they will be installed when ispell.el is loaded. | ||
| 43 | 47 | ||
| 44 | ;; Depending on the mail system you use, you may want to include these: | 48 | ;; Depending on the mail system you use, you may want to include these: |
| 45 | |||
| 46 | ;; (add-hook 'news-inews-hook 'ispell-message) | 49 | ;; (add-hook 'news-inews-hook 'ispell-message) |
| 47 | ;; (add-hook 'mail-send-hook 'ispell-message) | 50 | ;; (add-hook 'mail-send-hook 'ispell-message) |
| 48 | ;; (add-hook 'mh-before-send-letter-hook 'ispell-message) | 51 | ;; (add-hook 'mh-before-send-letter-hook 'ispell-message) |
| 49 | 52 | ||
| 50 | 53 | ;; Ispell has a TeX parser and a nroff parser (the default). | |
| 51 | ;; Ispell has a TeX parser and a nroff parser (the default). | ||
| 52 | ;; The parsing is controlled by the variable ispell-parser. Currently | 54 | ;; The parsing is controlled by the variable ispell-parser. Currently |
| 53 | ;; it is just a "toggle" between TeX and nroff, but if more parsers are | 55 | ;; it is just a "toggle" between TeX and nroff, but if more parsers are |
| 54 | ;; added it will be updated. See the variable description for more info. | 56 | ;; added it will be updated. See the variable description for more info. |
| @@ -112,16 +114,41 @@ | |||
| 112 | ;; `ispell-message' contains some custom skipping code for e-mail messages. | 114 | ;; `ispell-message' contains some custom skipping code for e-mail messages. |
| 113 | 115 | ||
| 114 | ;; BUGS: | 116 | ;; BUGS: |
| 115 | ;; Accepting definitions in latex mode can mess up math mode skipping... | 117 | ;; Accepting word definitions in latex mode can mess up math mode skipping. |
| 116 | ;; On some versions of emacs, growing the minibuffer fails. | 118 | ;; On some versions of emacs, growing the minibuffer fails. |
| 117 | ;; Autoloading ispell can result in problems if you need to use a local or | 119 | ;; see `ispell-help-in-bufferp'. |
| 118 | ;; modified dictionary. Place the following in your .emacs file to | 120 | |
| 119 | ;; override the autoload definitions: | 121 | ;; HISTORY |
| 120 | ;; (setq ispell-dictionary-alist (cons '(dictionary ...) | 122 | |
| 121 | ;; ispell-dictionary-alist)) | 123 | ;; Modifications made in latest versions: |
| 122 | ;; (setq ispell-menu-map nil) | 124 | |
| 123 | ;; (setq ispell-dictionary-alist-override t) | 125 | ;; Revision 3.2 1999/5/7 14:25:14 kss |
| 124 | ;; (load-library "ispell") | 126 | ;; Accept ispell versions 3.X.Y where X>=1 |
| 127 | ;; fine tuned latex region skipping. Fixed bug in ispell-word that did not | ||
| 128 | ;; point in right place on words < 2 chars. Simplified ispell-minor-mode. | ||
| 129 | ;; Fixed bug in TeX parsing when math commands are in the comments. | ||
| 130 | ;; Removed calls to `when' macro. | ||
| 131 | |||
| 132 | ;; Revision 3.1 1998/12/1 13:21:52 kss | ||
| 133 | ;; Improved and fixed customize support. | ||
| 134 | ;; Improved and fixed comments in variables and messages. | ||
| 135 | ;; A coding system is now required for all languages. | ||
| 136 | ;; casechars improved for castellano, castellano8, and norsk dictionaries. | ||
| 137 | ;; Dictionary norsk7-tex removed. Dictionary polish added. | ||
| 138 | ;; Dictionaries redefined at load-time to support dictionary changes. | ||
| 139 | ;; Menu redefined at load time to support dictionary changes. | ||
| 140 | ;; ispell-check-version added as an alias for `check-ispell-version'. | ||
| 141 | ;; Spelling suggestions returned in order generated by ispell. | ||
| 142 | ;; Small bug fixed in matching ispell error messages. | ||
| 143 | ;; Robustness added to ensure `case-fold-search' doesn't get redefined. | ||
| 144 | ;; Fixed bug that didn't respect case of word in `ispell-complete-word'. | ||
| 145 | ;; Multibyte character coding support added for process interactions. | ||
| 146 | ;; Ensure ispell process has terminated before starting new process. | ||
| 147 | ;; This can otherwise confuse process filters and hang ispell. | ||
| 148 | ;; Improved skipping support for sgml. | ||
| 149 | ;; Fixed bug using ^M rather than \r in `ispell-minor-check'. | ||
| 150 | ;; Improved message reference matching in `ispell-message'. | ||
| 151 | ;; Fixed bug in returning to nroff mode from tex mode. | ||
| 125 | 152 | ||
| 126 | 153 | ||
| 127 | ;;; Code: | 154 | ;;; Code: |
| @@ -147,8 +174,7 @@ | |||
| 147 | ;;; ********************************************************************** | 174 | ;;; ********************************************************************** |
| 148 | 175 | ||
| 149 | 176 | ||
| 150 | ;;; ******* THIS FILE IS WRITTEN FOR ISPELL VERSION 3.1 | 177 | ;;; ******* THIS FILE IS WRITTEN FOR ISPELL VERSION 3.1+ |
| 151 | ;;; Code: | ||
| 152 | 178 | ||
| 153 | (defcustom ispell-highlight-p 'block | 179 | (defcustom ispell-highlight-p 'block |
| 154 | "*Highlight spelling errors when non-nil. | 180 | "*Highlight spelling errors when non-nil. |
| @@ -370,6 +396,31 @@ for language-specific arguments." | |||
| 370 | :type '(repeat string) | 396 | :type '(repeat string) |
| 371 | :group 'ispell) | 397 | :group 'ispell) |
| 372 | 398 | ||
| 399 | |||
| 400 | ;; Define definitions here only for personal dictionaries. | ||
| 401 | (defcustom ispell-local-dictionary-alist nil | ||
| 402 | "*Contains local or customized dictionary definitions. | ||
| 403 | See `ispell-dictionary-alist'." | ||
| 404 | :type '(repeat (list (choice :tag "Dictionary" | ||
| 405 | (string :tag "Dictionary name") | ||
| 406 | (const :tag "default" nil)) | ||
| 407 | (regexp :tag "Case characters") | ||
| 408 | (regexp :tag "Non case characters") | ||
| 409 | (regexp :tag "Other characters") | ||
| 410 | (boolean :tag "Many other characters") | ||
| 411 | (repeat :tag "Ispell command line args" | ||
| 412 | (string :tag "Arg")) | ||
| 413 | (choice :tag "Extended character mode" | ||
| 414 | (const "~tex") (const "~plaintex") | ||
| 415 | (const "~nroff") (const "~list") | ||
| 416 | (const "~latin1") (const "~latin3") | ||
| 417 | (const :tag "default" nil)) | ||
| 418 | (choice :tag "Character set" | ||
| 419 | (const iso-8859-1) | ||
| 420 | (const iso-8859-2)))) | ||
| 421 | :group 'ispell) | ||
| 422 | |||
| 423 | |||
| 373 | ;;; split dictionary so line length is smaller in loaddefs.el | 424 | ;;; split dictionary so line length is smaller in loaddefs.el |
| 374 | 425 | ||
| 375 | ;;; First part of dictionary, shortened for loaddefs.el | 426 | ;;; First part of dictionary, shortened for loaddefs.el |
| @@ -378,7 +429,7 @@ for language-specific arguments." | |||
| 378 | ispell-dictionary-alist-1 | 429 | ispell-dictionary-alist-1 |
| 379 | '((nil ; default (English.aff) | 430 | '((nil ; default (English.aff) |
| 380 | "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) | 431 | "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) |
| 381 | ("american" ; yankee English | 432 | ("american" ; Yankee English |
| 382 | "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) | 433 | "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1) |
| 383 | ("british" ; British version | 434 | ("british" ; British version |
| 384 | "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "british") nil iso-8859-1) | 435 | "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "british") nil iso-8859-1) |
| @@ -471,7 +522,7 @@ for language-specific arguments." | |||
| 471 | ;;;###autoload | 522 | ;;;###autoload |
| 472 | (setq | 523 | (setq |
| 473 | ispell-dictionary-alist-6 | 524 | ispell-dictionary-alist-6 |
| 474 | '(("russian" ; russian.aff (KOI8-R charset) | 525 | '(("russian" ; Russian.aff (KOI8-R charset) |
| 475 | "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" | 526 | "[\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" |
| 476 | "[^\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" | 527 | "[^\341\342\367\347\344\345\263\366\372\351\352\353\354\355\356\357\360\362\363\364\365\346\350\343\376\373\375\370\371\377\374\340\361\301\302\327\307\304\305\243\326\332\311\312\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\330\331\337\334\300\321]" |
| 477 | "[']" t ("-C" "-d" "russian") "~latin1" iso-8859-1) | 528 | "[']" t ("-C" "-d" "russian") "~latin1" iso-8859-1) |
| @@ -484,7 +535,8 @@ for language-specific arguments." | |||
| 484 | 535 | ||
| 485 | ;;;###autoload | 536 | ;;;###autoload |
| 486 | (defcustom ispell-dictionary-alist | 537 | (defcustom ispell-dictionary-alist |
| 487 | (append ispell-dictionary-alist-1 ispell-dictionary-alist-2 | 538 | (append ispell-local-dictionary-alist ; dictionary customizations |
| 539 | ispell-dictionary-alist-1 ispell-dictionary-alist-2 | ||
| 488 | ispell-dictionary-alist-3 ispell-dictionary-alist-4 | 540 | ispell-dictionary-alist-3 ispell-dictionary-alist-4 |
| 489 | ispell-dictionary-alist-5 ispell-dictionary-alist-6) | 541 | ispell-dictionary-alist-5 ispell-dictionary-alist-6) |
| 490 | "An alist of dictionaries and their associated parameters. | 542 | "An alist of dictionaries and their associated parameters. |
| @@ -552,14 +604,12 @@ LANGUAGE.aff file \(e.g., english.aff\)." | |||
| 552 | (const iso-8859-2)))) | 604 | (const iso-8859-2)))) |
| 553 | :group 'ispell) | 605 | :group 'ispell) |
| 554 | 606 | ||
| 555 | (defvar ispell-dictionary-alist-override nil) | ||
| 556 | |||
| 557 | ;;; update the dictionaries at load time | 607 | ;;; update the dictionaries at load time |
| 558 | (unless ispell-dictionary-alist-override | 608 | (setq ispell-dictionary-alist |
| 559 | (setq ispell-dictionary-alist | 609 | (append ispell-local-dictionary-alist ; dictionary customizations |
| 560 | (append ispell-dictionary-alist-1 ispell-dictionary-alist-2 | 610 | ispell-dictionary-alist-1 ispell-dictionary-alist-2 |
| 561 | ispell-dictionary-alist-3 ispell-dictionary-alist-4 | 611 | ispell-dictionary-alist-3 ispell-dictionary-alist-4 |
| 562 | ispell-dictionary-alist-5 ispell-dictionary-alist-6))) | 612 | ispell-dictionary-alist-5 ispell-dictionary-alist-6)) |
| 563 | 613 | ||
| 564 | ;;; The preparation of the menu bar menu must be autoloaded | 614 | ;;; The preparation of the menu bar menu must be autoloaded |
| 565 | ;;; because otherwise this file gets autoloaded every time Emacs starts | 615 | ;;; because otherwise this file gets autoloaded every time Emacs starts |
| @@ -696,7 +746,7 @@ and added as a submenu of the \"Edit\" menu.") | |||
| 696 | 746 | ||
| 697 | ;;; The version must be 3.1 or greater for this version of ispell.el | 747 | ;;; The version must be 3.1 or greater for this version of ispell.el |
| 698 | ;;; There is an incompatibility between version 3.1.12 and lower versions. | 748 | ;;; There is an incompatibility between version 3.1.12 and lower versions. |
| 699 | (defconst ispell-required-version '("3.1." 12) | 749 | (defconst ispell-required-version '(3 1 12) |
| 700 | "Ispell versions with which this version of ispell.el is known to work.") | 750 | "Ispell versions with which this version of ispell.el is known to work.") |
| 701 | (defvar ispell-offset -1 | 751 | (defvar ispell-offset -1 |
| 702 | "Offset that maps protocol differences between ispell 3.1 versions.") | 752 | "Offset that maps protocol differences between ispell 3.1 versions.") |
| @@ -810,7 +860,7 @@ The last occurring definition in the buffer will be used.") | |||
| 810 | ("\\(/\\|\\(\\(\\w\\|-\\)+[.:@]\\)\\)\\(\\w\\|-\\)*\\([.:/@]+\\(\\w\\|-\\|~\\)+\\)+") | 860 | ("\\(/\\|\\(\\(\\w\\|-\\)+[.:@]\\)\\)\\(\\w\\|-\\)*\\([.:/@]+\\(\\w\\|-\\|~\\)+\\)+") |
| 811 | ;; This is a pretty complex regexp. It can be simplified to the following: | 861 | ;; This is a pretty complex regexp. It can be simplified to the following: |
| 812 | ;; "\\(\\w\\|-\\)*\\([.:/@]+\\(\\w\\|-\\|~\\)+\\)+" | 862 | ;; "\\(\\w\\|-\\)*\\([.:/@]+\\(\\w\\|-\\|~\\)+\\)+" |
| 813 | ;; but some valid text will be skipped, e.g. "his/herr". This could be | 863 | ;; but some valid text will be skipped, e.g. "his/her". This could be |
| 814 | ;; fixed up (at the expense of a moderately more complex regexp) | 864 | ;; fixed up (at the expense of a moderately more complex regexp) |
| 815 | ;; by not allowing "/" to be the character which triggers the | 865 | ;; by not allowing "/" to be the character which triggers the |
| 816 | ;; identification of the computer name, e.g.: | 866 | ;; identification of the computer name, e.g.: |
| @@ -828,14 +878,14 @@ Valid forms include: | |||
| 828 | 878 | ||
| 829 | ;;;###autoload | 879 | ;;;###autoload |
| 830 | (defvar ispell-tex-skip-alists | 880 | (defvar ispell-tex-skip-alists |
| 831 | '((("%\\[" . "%\\]") | 881 | '((;;("%\\[" . "%\\]") ; AMStex block comment... |
| 832 | ;; All the standard LaTeX keywords from L. Lamport's guide: | 882 | ;; All the standard LaTeX keywords from L. Lamport's guide: |
| 833 | ;; \cite, \hspace, \hspace*, \hyphenation, \include, \includeonly, \input, | 883 | ;; \cite, \hspace, \hspace*, \hyphenation, \include, \includeonly, \input, |
| 834 | ;; \label, \nocite, \rule (in ispell - rest included here) | 884 | ;; \label, \nocite, \rule (in ispell - rest included here) |
| 835 | ("\\\\addcontentsline" ispell-tex-arg-end 2) | 885 | ("\\\\addcontentsline" ispell-tex-arg-end 2) |
| 836 | ("\\\\add\\(tocontents\\|vspace\\)" ispell-tex-arg-end) | 886 | ("\\\\add\\(tocontents\\|vspace\\)" ispell-tex-arg-end) |
| 837 | ("\\\\\\([aA]lph\\|arabic\\)" ispell-tex-arg-end) | 887 | ("\\\\\\([aA]lph\\|arabic\\)" ispell-tex-arg-end) |
| 838 | ("\\\\author" ispell-tex-arg-end) | 888 | ;;("\\\\author" ispell-tex-arg-end) |
| 839 | ("\\\\bibliographystyle" ispell-tex-arg-end) | 889 | ("\\\\bibliographystyle" ispell-tex-arg-end) |
| 840 | ("\\\\makebox" ispell-tex-arg-end 0) | 890 | ("\\\\makebox" ispell-tex-arg-end 0) |
| 841 | ;;("\\\\epsfig" ispell-tex-arg-end) | 891 | ;;("\\\\epsfig" ispell-tex-arg-end) |
| @@ -950,7 +1000,8 @@ or \\[ispell-region] to update the Ispell process." | |||
| 950 | word (car word)) | 1000 | word (car word)) |
| 951 | 1001 | ||
| 952 | ;; now check spelling of word if it has 3 or more characters. | 1002 | ;; now check spelling of word if it has 3 or more characters. |
| 953 | (when (> (length word) 2) | 1003 | (cond |
| 1004 | ((> (length word) 2) | ||
| 954 | (or quietly | 1005 | (or quietly |
| 955 | (message "Checking spelling of %s..." | 1006 | (message "Checking spelling of %s..." |
| 956 | (funcall ispell-format-word word))) | 1007 | (funcall ispell-format-word word))) |
| @@ -1003,9 +1054,9 @@ or \\[ispell-region] to update the Ispell process." | |||
| 1003 | (ispell-region start end))))) | 1054 | (ispell-region start end))))) |
| 1004 | (if (get-buffer ispell-choices-buffer) | 1055 | (if (get-buffer ispell-choices-buffer) |
| 1005 | (kill-buffer ispell-choices-buffer)))) | 1056 | (kill-buffer ispell-choices-buffer)))) |
| 1006 | (goto-char cursor-location) ; return to original location | ||
| 1007 | (ispell-pdict-save ispell-silently-savep) | 1057 | (ispell-pdict-save ispell-silently-savep) |
| 1008 | (if ispell-quit (setq ispell-quit nil)))))) | 1058 | (if ispell-quit (setq ispell-quit nil)))) |
| 1059 | (goto-char cursor-location)))) ; return to original location | ||
| 1009 | 1060 | ||
| 1010 | 1061 | ||
| 1011 | (defun ispell-get-word (following &optional extra-otherchars) | 1062 | (defun ispell-get-word (following &optional extra-otherchars) |
| @@ -1086,7 +1137,7 @@ If so, ask if it needs to be saved." | |||
| 1086 | (if (or ispell-pdict-modified-p force-save) | 1137 | (if (or ispell-pdict-modified-p force-save) |
| 1087 | (if (or no-query (y-or-n-p "Personal dictionary modified. Save? ")) | 1138 | (if (or no-query (y-or-n-p "Personal dictionary modified. Save? ")) |
| 1088 | (progn | 1139 | (progn |
| 1089 | (process-send-string ispell-process "#\n") | 1140 | (process-send-string ispell-process "#\n") ; save dictionary |
| 1090 | (message "Personal dictionary saved.")))) | 1141 | (message "Personal dictionary saved.")))) |
| 1091 | ;; unassert variable, even if not saved to avoid questioning. | 1142 | ;; unassert variable, even if not saved to avoid questioning. |
| 1092 | (setq ispell-pdict-modified-p nil)) | 1143 | (setq ispell-pdict-modified-p nil)) |
| @@ -1321,7 +1372,7 @@ Global `ispell-quit' set to start location to continue spell session." | |||
| 1321 | (ispell-highlight-spelling-error start end nil | 1372 | (ispell-highlight-spelling-error start end nil |
| 1322 | 'block)) | 1373 | 'block)) |
| 1323 | t) ; reselect from new choices | 1374 | t) ; reselect from new choices |
| 1324 | ((= char ?u) | 1375 | ((= char ?u) ; insert lowercase into dictionary |
| 1325 | (process-send-string ispell-process | 1376 | (process-send-string ispell-process |
| 1326 | (concat "*" (downcase word) "\n")) | 1377 | (concat "*" (downcase word) "\n")) |
| 1327 | (setq ispell-pdict-modified-p '(t)) ; dictionary modified! | 1378 | (setq ispell-pdict-modified-p '(t)) ; dictionary modified! |
| @@ -1675,7 +1726,7 @@ scrolling the current window. Leave the new window selected." | |||
| 1675 | (save-excursion | 1726 | (save-excursion |
| 1676 | (let ((oldot (save-excursion (forward-line -1) (point))) | 1727 | (let ((oldot (save-excursion (forward-line -1) (point))) |
| 1677 | (top (save-excursion (move-to-window-line height) (point)))) | 1728 | (top (save-excursion (move-to-window-line height) (point)))) |
| 1678 | ;; If line above old point (line starting at olddot) would be | 1729 | ;; If line above old point (line starting at oldot) would be |
| 1679 | ;; hidden by new window, scroll it to just below new win | 1730 | ;; hidden by new window, scroll it to just below new win |
| 1680 | ;; otherwise set top line of other win so it doesn't scroll. | 1731 | ;; otherwise set top line of other win so it doesn't scroll. |
| 1681 | (if (< oldot top) (setq top oldot)) | 1732 | (if (< oldot top) (setq top oldot)) |
| @@ -1778,18 +1829,25 @@ scrolling the current window. Leave the new window selected." | |||
| 1778 | (setq case-fold-search t | 1829 | (setq case-fold-search t |
| 1779 | status (re-search-forward | 1830 | status (re-search-forward |
| 1780 | (concat "\\<\\(" | 1831 | (concat "\\<\\(" |
| 1781 | (regexp-quote (car ispell-required-version)) | 1832 | (format "%d" (car ispell-required-version)) |
| 1782 | "\\)\\([0-9]*\\)\\>") | 1833 | "\\)\\.\\([0-9]*\\)\\.\\([0-9]*\\)\\>") |
| 1783 | nil t) | 1834 | nil t) |
| 1784 | case-fold-search case-fold-search-val) | 1835 | case-fold-search case-fold-search-val) |
| 1785 | (if (not status) | 1836 | (if (or (not status) ; major version mismatch |
| 1786 | (error "%s version 3 release %s%s or greater is required" | 1837 | (< (car (read-from-string (buffer-substring-no-properties |
| 1838 | (match-beginning 2) (match-end 2)))) | ||
| 1839 | (car (cdr ispell-required-version)))) ; minor version mismatch | ||
| 1840 | (error "%s version 3 release %d.%d.%d or greater is required" | ||
| 1787 | ispell-program-name (car ispell-required-version) | 1841 | ispell-program-name (car ispell-required-version) |
| 1788 | (car (cdr ispell-required-version))) | 1842 | (car (cdr ispell-required-version)) |
| 1843 | (car (cdr (cdr ispell-required-version)))) | ||
| 1789 | ;; check that it is the correct version. | 1844 | ;; check that it is the correct version. |
| 1790 | (if (< (car (read-from-string (buffer-substring-no-properties | 1845 | (if (and (= (car (read-from-string (buffer-substring-no-properties |
| 1791 | (match-beginning 2) (match-end 2)))) | 1846 | (match-beginning 2)(match-end 2)))) |
| 1792 | (car (cdr ispell-required-version))) | 1847 | (car (cdr ispell-required-version))) |
| 1848 | (< (car (read-from-string (buffer-substring-no-properties | ||
| 1849 | (match-beginning 3)(match-end 3)))) | ||
| 1850 | (car (cdr (cdr ispell-required-version))))) | ||
| 1793 | (setq ispell-offset 0))) | 1851 | (setq ispell-offset 0))) |
| 1794 | (kill-buffer (current-buffer))) | 1852 | (kill-buffer (current-buffer))) |
| 1795 | result)) | 1853 | result)) |
| @@ -1870,7 +1928,7 @@ scrolling the current window. Leave the new window selected." | |||
| 1870 | (error "%s" (mapconcat 'identity ispell-filter "\n")))) | 1928 | (error "%s" (mapconcat 'identity ispell-filter "\n")))) |
| 1871 | (setq ispell-filter nil) ; Discard version ID line | 1929 | (setq ispell-filter nil) ; Discard version ID line |
| 1872 | (let ((extended-char-mode (ispell-get-extended-character-mode))) | 1930 | (let ((extended-char-mode (ispell-get-extended-character-mode))) |
| 1873 | (if extended-char-mode | 1931 | (if extended-char-mode ; ~ extended character mode |
| 1874 | (process-send-string ispell-process | 1932 | (process-send-string ispell-process |
| 1875 | (concat extended-char-mode "\n")))) | 1933 | (concat extended-char-mode "\n")))) |
| 1876 | (process-kill-without-query ispell-process))) | 1934 | (process-kill-without-query ispell-process))) |
| @@ -2178,8 +2236,8 @@ otherwise, the current line is skipped." | |||
| 2178 | (cond ; LOOK AT THIS LINE AND SKIP OR PROCESS | 2236 | (cond ; LOOK AT THIS LINE AND SKIP OR PROCESS |
| 2179 | ((eolp) ; END OF LINE, just go to next line. | 2237 | ((eolp) ; END OF LINE, just go to next line. |
| 2180 | (forward-line)) | 2238 | (forward-line)) |
| 2181 | ((looking-at "[---#@*+!%~^]") ; SKIP SPECIAL ISPELL CHARACTERS | 2239 | ;;((looking-at "[---#@*+!%~^]") ; SKIP SPECIAL ISPELL CHARACTERS |
| 2182 | (forward-char 1)) | 2240 | ;; (forward-char 1)) ; not needed as quoted below. |
| 2183 | ((or (re-search-forward ispell-casechars end t) ; TEXT EXISTS | 2241 | ((or (re-search-forward ispell-casechars end t) ; TEXT EXISTS |
| 2184 | (re-search-forward "[][()${}]" end t)) ; or MATH COMMANDS | 2242 | (re-search-forward "[][()${}]" end t)) ; or MATH COMMANDS |
| 2185 | (setq string (concat "^" (buffer-substring-no-properties start end) | 2243 | (setq string (concat "^" (buffer-substring-no-properties start end) |
| @@ -2327,14 +2385,14 @@ otherwise, the current line is skipped." | |||
| 2327 | (setq done t) | 2385 | (setq done t) |
| 2328 | (setq state (parse-partial-sexp (point) (point-max) | 2386 | (setq state (parse-partial-sexp (point) (point-max) |
| 2329 | nil nil state 'syntax-table)) | 2387 | nil nil state 'syntax-table)) |
| 2330 | (when (or (nth 3 state) (nth 4 state)) | 2388 | (if (or (nth 3 state) (nth 4 state)) |
| 2331 | (let ((start (point))) | 2389 | (let ((start (point))) |
| 2332 | (setq state (parse-partial-sexp start (point-max) | 2390 | (setq state (parse-partial-sexp start (point-max) |
| 2333 | nil nil state 'syntax-table)) | 2391 | nil nil state 'syntax-table)) |
| 2334 | (when (or (nth 3 state) (nth 4 state)) | 2392 | (if (or (nth 3 state) (nth 4 state)) |
| 2335 | (error "Unterminated string or comment")) | 2393 | (error "Unterminated string or comment")) |
| 2336 | (save-excursion | 2394 | (save-excursion |
| 2337 | (setq done (not (ispell-region start (point)))))))))) | 2395 | (setq done (not (ispell-region start (point)))))))))) |
| 2338 | 2396 | ||
| 2339 | 2397 | ||
| 2340 | ;;;###autoload | 2398 | ;;;###autoload |
| @@ -2493,15 +2551,11 @@ Don't read buffer-local settings or word lists." | |||
| 2493 | (let ((ispell-minor-mode nil) | 2551 | (let ((ispell-minor-mode nil) |
| 2494 | (ispell-check-only t) | 2552 | (ispell-check-only t) |
| 2495 | (last-char (char-after (1- (point))))) | 2553 | (last-char (char-after (1- (point))))) |
| 2496 | (if (or (eq last-char ?\ ) (eq last-char ?\n) | 2554 | (command-execute (key-binding (this-command-keys))) |
| 2497 | (and ispell-skip-sgml (eq last-char ?>)) | 2555 | (if (not (or (eq last-char ?\ ) (eq last-char ?\n) |
| 2498 | (and ispell-skip-sgml (eq last-char ?\;))) | 2556 | (and ispell-skip-sgml (eq last-char ?>)) |
| 2499 | nil | 2557 | (and ispell-skip-sgml (eq last-char ?\;)))) |
| 2500 | (save-window-excursion | 2558 | (ispell-word nil t)))) |
| 2501 | (save-restriction | ||
| 2502 | (narrow-to-region (save-excursion (forward-line -1) (point)) (point)) | ||
| 2503 | (ispell-word nil t)))) | ||
| 2504 | (command-execute (key-binding (this-command-keys))))) | ||
| 2505 | 2559 | ||
| 2506 | 2560 | ||
| 2507 | ;;; ********************************************************************** | 2561 | ;;; ********************************************************************** |
| @@ -2519,7 +2573,7 @@ Don't read buffer-local settings or word lists." | |||
| 2519 | "^%!PS-Adobe-[123].0" | 2573 | "^%!PS-Adobe-[123].0" |
| 2520 | ;; Matches uuencoded text | 2574 | ;; Matches uuencoded text |
| 2521 | "^begin [0-9][0-9][0-9] .*\nM.*\nM.*\nM" | 2575 | "^begin [0-9][0-9][0-9] .*\nM.*\nM.*\nM" |
| 2522 | ;; Matches shell files (esp. auto-decoding) | 2576 | ;; Matches shell files (especially auto-decoding) |
| 2523 | "^#! /bin/[ck]?sh" | 2577 | "^#! /bin/[ck]?sh" |
| 2524 | ;; Matches context difference listing | 2578 | ;; Matches context difference listing |
| 2525 | "\\(\\(^cd .*\n\\)?diff -c .*\\)?\n\\*\\*\\* .*\n--- .*\n\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*" | 2579 | "\\(\\(^cd .*\n\\)?diff -c .*\\)?\n\\*\\*\\* .*\n--- .*\n\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*\\*" |
| @@ -2676,9 +2730,12 @@ Includes Latex/Nroff modes and extended character mode." | |||
| 2676 | ;; (ispell-init-process) must already be called. | 2730 | ;; (ispell-init-process) must already be called. |
| 2677 | (process-send-string ispell-process "!\n") ; Put process in terse mode. | 2731 | (process-send-string ispell-process "!\n") ; Put process in terse mode. |
| 2678 | ;; We assume all major modes with "tex-mode" in them should use latex parsing | 2732 | ;; We assume all major modes with "tex-mode" in them should use latex parsing |
| 2679 | (if (or (and (eq ispell-parser 'use-mode-name) | 2733 | ;; When exclusively checking comments, set to raw text mode (nroff). |
| 2680 | (string-match "[Tt][Ee][Xx]-mode" (symbol-name major-mode))) | 2734 | (if (and (not (eq 'exclusive ispell-check-comments)) |
| 2681 | (eq ispell-parser 'tex)) | 2735 | (or (and (eq ispell-parser 'use-mode-name) |
| 2736 | (string-match "[Tt][Ee][Xx]-mode" | ||
| 2737 | (symbol-name major-mode))) | ||
| 2738 | (eq ispell-parser 'tex))) | ||
| 2682 | (progn | 2739 | (progn |
| 2683 | (process-send-string ispell-process "+\n") ; set ispell mode to tex | 2740 | (process-send-string ispell-process "+\n") ; set ispell mode to tex |
| 2684 | (if (not (eq ispell-parser 'tex)) | 2741 | (if (not (eq ispell-parser 'tex)) |
| @@ -2705,7 +2762,8 @@ Includes Latex/Nroff modes and extended character mode." | |||
| 2705 | ;; space separated definitions. | 2762 | ;; space separated definitions. |
| 2706 | (setq string (downcase (buffer-substring-no-properties | 2763 | (setq string (downcase (buffer-substring-no-properties |
| 2707 | (match-beginning 1) (match-end 1)))) | 2764 | (match-beginning 1) (match-end 1)))) |
| 2708 | (cond ((string-match "latex-mode" string) | 2765 | (cond ((and (string-match "latex-mode" string) |
| 2766 | (not (eq 'exclusive ispell-check-comments))) | ||
| 2709 | (process-send-string ispell-process "+\n~tex\n")) | 2767 | (process-send-string ispell-process "+\n~tex\n")) |
| 2710 | ((string-match "nroff-mode" string) | 2768 | ((string-match "nroff-mode" string) |
| 2711 | (process-send-string ispell-process "-\n~nroff\n")) | 2769 | (process-send-string ispell-process "-\n~nroff\n")) |
| @@ -2822,7 +2880,7 @@ Both should not be used to define a buffer-local dictionary." | |||
| 2822 | (insert (concat " " word)))))))) | 2880 | (insert (concat " " word)))))))) |
| 2823 | 2881 | ||
| 2824 | 2882 | ||
| 2825 | (defconst ispell-version "ispell.el 3.1 -- Mon Nov 30 20:32:48 PST 1998") | 2883 | (defconst ispell-version "ispell.el 3.2 -- Fri May 7 14:25:14 PDT 1999") |
| 2826 | 2884 | ||
| 2827 | (provide 'ispell) | 2885 | (provide 'ispell) |
| 2828 | 2886 | ||
| @@ -2834,7 +2892,7 @@ Both should not be used to define a buffer-local dictionary." | |||
| 2834 | ;;; eval: expression | 2892 | ;;; eval: expression |
| 2835 | ;;; local-variable: value | 2893 | ;;; local-variable: value |
| 2836 | 2894 | ||
| 2837 | ;;; The following sets the buffer local dictionary to 'american' English | 2895 | ;;; The following sets the buffer local dictionary to `american' English |
| 2838 | ;;; and spell checks only comments. | 2896 | ;;; and spell checks only comments. |
| 2839 | 2897 | ||
| 2840 | ;;; Local Variables: | 2898 | ;;; Local Variables: |
| @@ -2852,15 +2910,13 @@ Both should not be used to define a buffer-local dictionary." | |||
| 2852 | ;;; Change IspellPersDict to IspellPersDict: to enable the following line. | 2910 | ;;; Change IspellPersDict to IspellPersDict: to enable the following line. |
| 2853 | ;;; Local IspellPersDict ~/.ispell_lisp | 2911 | ;;; Local IspellPersDict ~/.ispell_lisp |
| 2854 | ;;; The following were automatically generated by ispell using the 'A' command: | 2912 | ;;; The following were automatically generated by ispell using the 'A' command: |
| 2855 | ; LocalWords: Moellmann copyleft Dansk russian KOI charset minipage hspace mh | 2913 | ; LocalWords: settable alist inews mh frag pdict Wildcards iconify arg tex kss |
| 2856 | ; LocalWords: unsplitable includeonly nocite epsfig displaymath eqnarray init | 2914 | ; LocalWords: alists minibuffer bufferp autoload loaddefs aff Dansk KOI SPC op |
| 2857 | ; LocalWords: settable autoload inews frag pdict alist Wildcards iconify arg | 2915 | ; LocalWords: Francais Nederlands charset autoloaded popup nonmenu regexp num |
| 2858 | ; LocalWords: tex alists minibuffer Autoloading setq changelog kss stevens reg | 2916 | ; LocalWords: AMStex hspace includeonly nocite epsfig displaymath eqnarray reg |
| 2859 | ; LocalWords: Castellano framepop sgml modeline Wedler Dirk Froembgen fn Gerd | 2917 | ; LocalWords: minipage modeline pers dict unhighlight buf grep sync prev inc |
| 2860 | ; LocalWords: pgp NZST Vignaux autoloaded loaddefs aff Francais Nederlands SPC | 2918 | ; LocalWords: fn hilight oldot NB AIX msg init read's bufs pt cmd Quinlan eg |
| 2861 | ; LocalWords: popup nonmenu regexp herr num pers dict unhighlight ccept uit NB | 2919 | ; LocalWords: uuencoded unidiff sc nn VM SGML eval IspellPersDict unsplitable |
| 2862 | ; LocalWords: buf grep sync prev inc hilight olddot AIX ersion msg read's op | 2920 | ; LocalWords: lns |
| 2863 | ; LocalWords: bufs pt multibyte cmd Quinlan uuencoded esp unidiff eg sc | ||
| 2864 | ; LocalWords: VM lns HTML eval american IspellPersDict | ||
| 2865 | 2921 | ||
| 2866 | ;;; ispell.el ends here | 2922 | ;;; ispell.el ends here |