/[emacs]/emacs/lisp/textmodes/ispell.el
ViewVC logotype

Diff of /emacs/lisp/textmodes/ispell.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.137.4.2 by monnier, Tue May 13 22:51:58 2003 UTC revision 1.137.4.3 by monnier, Tue May 13 22:52:20 2003 UTC
# Line 1  Line 1 
1  ;;; ispell.el --- Interface to International Ispell Versions 3.1 and 3.2  ;;; ispell.el --- Interface to International Ispell Versions 3.1 and 3.2
2    
3  ;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.  ;; Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
4    
5  ;; Author: Ken Stevens <k.stevens@ieee.org>  ;; Author:           Ken Stevens <k.stevens@ieee.org>
6  ;; Maintainer: <k.stevens@ieee.org>  ;; Maintainer:       Ken Stevens <k.stevens@ieee.org>
7  ;; Stevens Mod Date: Fri Aug  4 09:41:50 PDT 2000  ;; Stevens Mod Date: Wed Jul 11 18:43:57 PDT 2001
8  ;; Stevens Revision: 3.4  ;; Stevens Revision: 3.5
9  ;; Status          : Release with 3.1.12+ and 3.2.0+ ispell.  ;; Status          : Release with 3.1.12+ and 3.2.0+ ispell.
10  ;; Bug Reports     : ispell-el-bugs@itcorp.com  ;; Bug Reports     : ispell-el-bugs@itcorp.com
11  ;; Web Site        : http://kdstevens.com/~stevens/ispell-page.html  ;; Web Site        : http://kdstevens.com/~stevens/ispell-page.html
# Line 129  Line 129 
129    
130  ;; Modifications made in latest versions:  ;; Modifications made in latest versions:
131    
132    ;; Revision 3.5 2001/7/11 18:43:57      kss
133    ;; Added fix for aspell to work in XEmacs (check-ispell-version).
134    ;; Added Portuguese dictionary definition.
135    ;; New feature: MIME mail message support, Fcc support.
136    ;; Bug fix: retain comment syntax on lines with region skipping. (TeX $ bug...)
137    ;; Improved allocation for graphic mode lines.  (Miles Bader)
138    ;; Support -v flag for old versions of aspell.  (Eli Zaretskii)
139    ;; Clear minibuffer on ^G from ispell-help (Tak Ota)
140    
141  ;; Revision 3.4 2000/8/4 09:41:50       kss  ;; Revision 3.4 2000/8/4 09:41:50       kss
142  ;; Support new color display functions.  ;; Support new color display functions.
143  ;; Fixed misalignment offset bug when replacing a string after a shift made.  ;; Fixed misalignment offset bug when replacing a string after a shift made.
# Line 137  Line 146 
146  ;; Added dictionary definition for Italian (William Deakin)  ;; Added dictionary definition for Italian (William Deakin)
147  ;; HTML region skipping greatly improved. (Chuck D. Phillips)  ;; HTML region skipping greatly improved. (Chuck D. Phillips)
148  ;; improved menus.  Fixed regexp matching http/email addresses.  ;; improved menus.  Fixed regexp matching http/email addresses.
149  ;; one arg always for xemacs sleep-for (gunnar Evermann)  ;; one arg always for XEmacs sleep-for (gunnar Evermann)
150  ;; support for synchronous processes (Eli Zaretskii)  ;; support for synchronous processes (Eli Zaretskii)
151    
152  ;; Revision 3.3  1999/11/29 11:38:34     kss  ;; Revision 3.3  1999/11/29 11:38:34     kss
# Line 214  Line 223 
223    
224  (and (not version18p)  (and (not version18p)
225       (not (boundp 'epoch::version))       (not (boundp 'epoch::version))
      (defalias 'ispell 'ispell-buffer)  
226       (defalias 'ispell-check-version 'check-ispell-version))       (defalias 'ispell-check-version 'check-ispell-version))
227    
228    
# Line 279  This minimizes redisplay thrashing." Line 287  This minimizes redisplay thrashing."
287    :type 'boolean    :type 'boolean
288    :group 'ispell)    :group 'ispell)
289    
290  (defcustom ispell-choices-win-default-height (if xemacsp 3 2)  (defcustom ispell-choices-win-default-height 2
291    "*The default size of the `*Choices*' window, including mode line.    "*The default size of the `*Choices*' window, including mode line.
292  Must be greater than 1.  Must be greater than 1."
 XEmacs modeline is thicker than a line of text, so it partially covers the  
 last line of text in the buffer.  Include an extra line in XEmacs to see  
 all of the choices clearly."  
293    :type 'integer    :type 'integer
294    :group 'ispell)    :group 'ispell)
295    
# Line 322  E.g. you may use the following value: Line 327  E.g. you may use the following value:
327    :group 'ispell)    :group 'ispell)
328    
329    
330    (defcustom ispell-message-fcc-skip 50000
331      "*Query before saving Fcc message copy if attachment larger than this value.
332    Nil always stores Fcc copy of message."
333      :type '(choice integer (const :tag "off" nil))
334      :group 'ispell)
335    
336    
337  (defcustom ispell-grep-command "egrep"  (defcustom ispell-grep-command "egrep"
338    "Name of the grep command for search processes."    "Name of the grep command for search processes."
339    :type 'string    :type 'string
# Line 455  for language-specific arguments." Line 467  for language-specific arguments."
467    "*Indicates whether ispell should skip spell checking of SGML markup.    "*Indicates whether ispell should skip spell checking of SGML markup.
468  If t, always skip SGML markup; if nil, never skip; if non-t and non-nil,  If t, always skip SGML markup; if nil, never skip; if non-t and non-nil,
469  guess whether SGML markup should be skipped according to the name of the  guess whether SGML markup should be skipped according to the name of the
470  buffer's major mode."  buffer's major mode.
471    
472    This is a local variable.  To change the default value use `set-default'."
473    :type '(choice (const :tag "always" t) (const :tag "never" nil)    :type '(choice (const :tag "always" t) (const :tag "never" nil)
474                   (const :tag "use-mode-name" use-mode-name))                   (const :tag "use-mode-name" use-mode-name))
475    :group 'ispell)    :group 'ispell)
476    
477    (make-variable-buffer-local 'ispell-skip-html)
478    
479    
480  ;;; Define definitions here only for personal dictionaries.  ;;; Define definitions here only for personal dictionaries.
481  ;;;###autoload  ;;;###autoload
# Line 586  See `ispell-dictionary-alist'." Line 602  See `ispell-dictionary-alist'."
602     ("norsk7-tex"                        ; 7 bit Norwegian TeX mode     ("norsk7-tex"                        ; 7 bit Norwegian TeX mode
603      "[A-Za-z{}\\'^`]" "[^A-Za-z{}\\'^`]"      "[A-Za-z{}\\'^`]" "[^A-Za-z{}\\'^`]"
604      "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1)      "[\"]" nil ("-d" "norsk") "~plaintex" iso-8859-1)
605     ("polish"                            ; polish mode     ("polish"                            ; Polish mode
606      "[A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"      "[A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"
607      "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"      "[^A-Za-z\241\243\246\254\257\261\263\266\274\277\306\312\321\323\346\352\361\363]"
608      "" nil ( "-d" "polish") nil iso-8859-2)))      "" nil ( "-d" "polish") nil iso-8859-2)
609       ("portugues"                         ; Portuguese mode
610        "[a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
611        "[^a-zA-Z\301\302\311\323\340\341\342\351\352\355\363\343\372]"
612        "[']" t ("-C" "-d" "portugues") "~latin1" iso-8859-1)))
613    
614    
615  ;;; Sixth part of dictionary, shortened for loaddefs.el  ;;; Sixth part of dictionary, shortened for loaddefs.el
# Line 602  See `ispell-dictionary-alist'." Line 622  See `ispell-dictionary-alist'."
622      "[\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]"      "[\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]"
623      "[^\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]"      "[^\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]"
624      "" nil ("-d" "russian") nil koi8-r)      "" nil ("-d" "russian") nil koi8-r)
625       ("slovak"                            ; Slovakian
626        "[A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]"
627        "[^A-Za-z\301\304\311\315\323\332\324\300\305\245\335\256\251\310\317\253\322\341\344\351\355\363\372\364\340\345\265\375\276\271\350\357\273\362]"
628        "" nil ("-B" "-d" "slovak") nil iso-8859-2)
629     ("svenska"                           ; Swedish mode     ("svenska"                           ; Swedish mode
630      "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]"      "[A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]"
631      "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]"      "[^A-Za-z\345\344\366\351\340\374\350\346\370\347\305\304\326\311\300\334\310\306\330\307]"
632      "[']" nil ("-C") "~list" iso-8859-1)))      "[']" nil ("-C") "~list" iso-8859-1)))
633    
634    
   
635  ;;;###autoload  ;;;###autoload
636  (defcustom ispell-dictionary-alist  (defcustom ispell-dictionary-alist
637    (append ispell-local-dictionary-alist ; dictionary customizations    (append ispell-local-dictionary-alist ; dictionary customizations
# Line 704  LANGUAGE.aff file \(e.g., english.aff\). Line 727  LANGUAGE.aff file \(e.g., english.aff\).
727  (defvar ispell-offset -1  (defvar ispell-offset -1
728    "Offset that maps protocol differences between ispell 3.1 versions.")    "Offset that maps protocol differences between ispell 3.1 versions.")
729    
730  (defconst ispell-version "ispell.el 3.4 -- Fri Aug  4 09:41:50 PDT 2000")  (defconst ispell-version "ispell.el 3.5 - 07/11/01")
731    
732    
733    ;;;###autoload
734  (defun check-ispell-version (&optional interactivep)  (defun check-ispell-version (&optional interactivep)
735    "Ensure that `ispell-program-name' is valid and the correct version.    "Ensure that `ispell-program-name' is valid and the correct version.
736  Returns version number if called interactively.  Returns version number if called interactively.
# Line 726  Otherwise returns the library path if de Line 750  Otherwise returns the library path if de
750      (save-excursion      (save-excursion
751        (set-buffer (get-buffer-create " *ispell-tmp*"))        (set-buffer (get-buffer-create " *ispell-tmp*"))
752        (erase-buffer)        (erase-buffer)
753        (setq status (call-process ispell-program-name nil t nil "-vv"))        (setq status (call-process
754                        ispell-program-name nil t nil
755                        ;; aspell doesn't accept the -vv switch.
756                        (let ((case-fold-search
757                               (memq system-type '(ms-dos windows-nt)))
758                              (speller
759                               (file-name-nondirectory ispell-program-name)))
760                          ;; Assume anything that isn't `aspell' is Ispell.
761                          (if (string-match "\\`aspell" speller) "-v" "-vv"))))
762        (goto-char (point-min))        (goto-char (point-min))
763        (if interactivep        (if (not interactivep)
764            (progn            ;; return library path.
765              (end-of-line)            (if (re-search-forward "LIBDIR = \\\"\\([^ \t\n]*\\)\\\"" nil t)
766              (setq result (concat (buffer-substring-no-properties (point-min)                (setq result (buffer-substring (match-beginning 1)
767                                                                   (point))                                               (match-end 1))))
768                                   ", "          ;; write message string to minibuffer
769                                   ispell-version))          (end-of-line)
770              (message result))          (message (concat (buffer-substring-no-properties (point-min) (point))
771          ;; return library path.                           ", " ispell-version)))
         (re-search-forward "LIBDIR = \\\"\\([^ \t\n]*\\)\\\"" nil t)  
         (if (match-beginning 0)  
             (setq result (buffer-substring (match-beginning 1) (match-end 1)))))  
772        (goto-char (point-min))        (goto-char (point-min))
773        (if (not (memq status '(0 nil)))        (if (not (memq status '(0 nil)))
774            (error "%s exited with %s %s" ispell-program-name            (error "%s exited with %s %s" ispell-program-name
# Line 800  and added as a submenu of the \"Edit\" m Line 829  and added as a submenu of the \"Edit\" m
829         (not xemacsp)         (not xemacsp)
830         'reload))         'reload))
831    
832  (defvar ispell-library-path (check-ispell-version)  (defvar ispell-library-path (if (or (not (fboundp 'byte-compiling-files-p))
833                                        (not (byte-compiling-files-p)))
834                                    (check-ispell-version))
835    "The directory where ispell dictionaries reside.")    "The directory where ispell dictionaries reside.")
836    
837    (defvar ispell-process nil
838      "The process object for Ispell.")
839    
840    (defvar ispell-async-processp (and (fboundp 'kill-process)
841                                       (fboundp 'process-send-string)
842                                       (fboundp 'accept-process-output)
843                                       ;;(fboundp 'start-process)
844                                       ;;(fboundp 'set-process-filter)
845                                       ;;(fboundp 'process-kill-without-query)
846                                       )
847      "Non-nil means that the OS supports asynchronous processes.")
848    
849  ;;;###autoload  ;;;###autoload
850  (if ispell-menu-map-needed  (if (and ispell-menu-map-needed
851             (or (not (fboundp 'byte-compiling-files-p))
852                 (not (byte-compiling-files-p))))
853      (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist)))      (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist)))
854            ;; `ispell-library-path' intentionally not defined in autoload            ;; `ispell-library-path' intentionally not defined in autoload
855            (path (and (boundp 'ispell-library-path) ispell-library-path))            (path (and (boundp 'ispell-library-path) ispell-library-path))
# Line 837  and added as a submenu of the \"Edit\" m Line 881  and added as a submenu of the \"Edit\" m
881    
882  ;;; define commands in menu in opposite order you want them to appear.  ;;; define commands in menu in opposite order you want them to appear.
883  ;;;###autoload  ;;;###autoload
884  (if ispell-menu-map-needed  (if (and ispell-menu-map-needed
885             (or (not (fboundp 'byte-compiling-files-p))
886                 (not (byte-compiling-files-p))))
887      (progn      (progn
888        (define-key ispell-menu-map [ispell-change-dictionary]        (define-key ispell-menu-map [ispell-change-dictionary]
889          '(menu-item "Change Dictionary..." ispell-change-dictionary          '(menu-item "Change Dictionary..." ispell-change-dictionary
890                      :help "Supply explicit path to dictionary"))                      :help "Supply explicit path to dictionary"))
891        (define-key ispell-menu-map [ispell-kill-ispell]        (define-key ispell-menu-map [ispell-kill-ispell]
892          '(menu-item "Kill Process" ispell-kill-ispell          '(menu-item "Kill Process" ispell-kill-ispell
893                      :enable (and ispell-process                      :enable (and (boundp 'ispell-process) ispell-process
894                                   (eq (ispell-process-status) 'run))                                   (eq (ispell-process-status) 'run))
895                      :help "Terminate Ispell subprocess"))                      :help "Terminate Ispell subprocess"))
896        (define-key ispell-menu-map [ispell-pdict-save]        (define-key ispell-menu-map [ispell-pdict-save]
# Line 864  and added as a submenu of the \"Edit\" m Line 910  and added as a submenu of the \"Edit\" m
910                      :help "Complete word fragment at cursor"))))                      :help "Complete word fragment at cursor"))))
911    
912  ;;;###autoload  ;;;###autoload
913  (if ispell-menu-map-needed  (if (and ispell-menu-map-needed
914             (or (not (fboundp 'byte-compiling-files-p))
915                 (not (byte-compiling-files-p))))
916      (progn      (progn
917        (define-key ispell-menu-map [ispell-continue]        (define-key ispell-menu-map [ispell-continue]
918          '(menu-item "Continue Spell-Checking" ispell-continue          '(menu-item "Continue Spell-Checking" ispell-continue
# Line 880  and added as a submenu of the \"Edit\" m Line 928  and added as a submenu of the \"Edit\" m
928          '(menu-item "Spell-Check Comments" ispell-comments-and-strings          '(menu-item "Spell-Check Comments" ispell-comments-and-strings
929                      :help "Spell-check only comments and strings"))))                      :help "Spell-check only comments and strings"))))
930    
   
931  ;;;###autoload  ;;;###autoload
932  (if ispell-menu-map-needed  (if (and ispell-menu-map-needed
933             (or (not (fboundp 'byte-compiling-files-p))
934                 (not (byte-compiling-files-p))))
935      (progn      (progn
936        (define-key ispell-menu-map [ispell-region]        (define-key ispell-menu-map [ispell-region]
937          '(menu-item "Spell-Check Region" ispell-region          '(menu-item "Spell-Check Region" ispell-region
# Line 897  and added as a submenu of the \"Edit\" m Line 946  and added as a submenu of the \"Edit\" m
946        ;;(put 'ispell-region 'menu-enable 'mark-active)        ;;(put 'ispell-region 'menu-enable 'mark-active)
947        (fset 'ispell-menu-map (symbol-value 'ispell-menu-map))))        (fset 'ispell-menu-map (symbol-value 'ispell-menu-map))))
948    
949  ;;; XEmacs versions 19 & 20  ;;; XEmacs versions 19+
950  (if (and xemacsp  (if (and xemacsp
951           (not version18p)           (not version18p)
952           (featurep 'menubar)           (featurep 'menubar)
# Line 946  and added as a submenu of the \"Edit\" m Line 995  and added as a submenu of the \"Edit\" m
995        (setq ispell-menu-xemacs menu)        (setq ispell-menu-xemacs menu)
996        (if current-menubar        (if current-menubar
997            (progn            (progn
998              (delete-menu-item '("Edit" "Spell")) ; in case already defined              (if (car (find-menu-item current-menubar '("Cmds")))
999              (add-menu '("Edit") "Spell" ispell-menu-xemacs)))))                  (progn
1000                      ;; XEmacs 21.2
1001                      (delete-menu-item '("Cmds" "Spell-Check"))
1002                      (add-menu '("Cmds") "Spell-Check" ispell-menu-xemacs))
1003                  ;; previous
1004                  (delete-menu-item '("Edit" "Spell")) ; in case already defined
1005                  (add-menu '("Edit") "Spell" ispell-menu-xemacs))))))
1006    
1007  ;;; Allow incrementing characters as integers in XEmacs 20  ;;; Allow incrementing characters as integers in XEmacs 20+
1008  (if (and xemacsp  (if (and xemacsp
1009           (fboundp 'int-char))           (fboundp 'int-char))
1010      (fset 'ispell-int-char 'int-char)      (fset 'ispell-int-char 'int-char)
# Line 999  Protects against bogus binding of `enabl Line 1054  Protects against bogus binding of `enabl
1054  (defun ispell-get-coding-system ()  (defun ispell-get-coding-system ()
1055    (nth 7 (assoc ispell-dictionary ispell-dictionary-alist)))    (nth 7 (assoc ispell-dictionary ispell-dictionary-alist)))
1056    
 (defvar ispell-process nil  
   "The process object for Ispell.")  
   
 (defvar ispell-async-processp (and (fboundp 'kill-process)  
                                    (fboundp 'process-send-string)  
                                    (fboundp 'accept-process-output)  
                                    ;;(fboundp 'start-process)  
                                    ;;(fboundp 'set-process-filter)  
                                    ;;(fboundp 'process-kill-without-query)  
                                    )  
   "Non-nil means that the OS supports asynchronous processes.")  
1057    
1058  (defvar ispell-pdict-modified-p nil  (defvar ispell-pdict-modified-p nil
1059    "Non-nil means personal dictionary has modifications to be saved.")    "Non-nil means personal dictionary has modifications to be saved.")
# Line 1044  Protects against bogus binding of `enabl Line 1088  Protects against bogus binding of `enabl
1088    "Marker for return point from recursive edit.")    "Marker for return point from recursive edit.")
1089    
1090  (defvar ispell-checking-message nil  (defvar ispell-checking-message nil
1091    "Non-nil when we're checking a mail message.")    "Non-nil when we're checking a mail message.
1092    Used to hold MIME boundaries.")
1093    
1094  (defconst ispell-choices-buffer "*Choices*")  (defconst ispell-choices-buffer "*Choices*")
1095    
# Line 1084  The last occurring definition in the buf Line 1129  The last occurring definition in the buf
1129      (ispell-pdict-keyword          forward-line)      (ispell-pdict-keyword          forward-line)
1130      (ispell-parsing-keyword        forward-line)      (ispell-parsing-keyword        forward-line)
1131      ("^---*BEGIN PGP [A-Z ]*--*" . "^---*END PGP [A-Z ]*--*")      ("^---*BEGIN PGP [A-Z ]*--*" . "^---*END PGP [A-Z ]*--*")
1132      ("^---* \\(Start of \\)?[Ff]orwarded [Mm]essage"   . "^---* End of [Ff]orwarded [Mm]essage")      ;; assume multiline uuencoded file? "\nM.*$"?
1133        ("^begin [0-9][0-9][0-9] [^ \t]+$" . "\nend\n")
1134        ("^%!PS-Adobe-[123].0"       . "\n%%EOF\n")
1135        ("^---* \\(Start of \\)?[Ff]orwarded [Mm]essage"
1136         . "^---* End of [Ff]orwarded [Mm]essage")
1137      ;; Matches e-mail addresses, file names, http addresses, etc.  The `-+'      ;; Matches e-mail addresses, file names, http addresses, etc.  The `-+'
1138      ;; pattern necessary for performance reasons when `-' part of word syntax.      ;; pattern necessary for performance reasons when `-' part of word syntax.
1139      ("\\(-+\\|\\(/\\|\\(\\(\\w\\|[-_]\\)+[.:@]\\)\\)\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_]\\|~\\)+\\)+\\)")      ("\\(--+\\|\\(/\\|\\(\\(\\w\\|[-_]\\)+[.:@]\\)\\)\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_~=?&]\\)+\\)+\\)")
1140      ;; This is a pretty complex regexp.  It can be simplified to the following:      ;; This is a pretty complex regexp.  It can be simplified to the following:
1141      ;; "\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_]\\|~\\)+\\)+"      ;; "\\(\\w\\|[-_]\\)*\\([.:/@]+\\(\\w\\|[-_]\\|~\\)+\\)+"
1142      ;; but some valid text will be skipped, e.g. "his/her".  This could be      ;; but some valid text will be skipped, e.g. "his/her".  This could be
# Line 1118  Valid forms include: Line 1167  Valid forms include:
1167       ;;("\\\\author"                     ispell-tex-arg-end)       ;;("\\\\author"                     ispell-tex-arg-end)
1168       ("\\\\bibliographystyle"            ispell-tex-arg-end)       ("\\\\bibliographystyle"            ispell-tex-arg-end)
1169       ("\\\\makebox"                      ispell-tex-arg-end 0)       ("\\\\makebox"                      ispell-tex-arg-end 0)
1170       ;;("\\\\epsfig"            ispell-tex-arg-end)       ("\\\\e?psfig"                      ispell-tex-arg-end)
1171       ("\\\\document\\(class\\|style\\)" .       ("\\\\document\\(class\\|style\\)" .
1172        "\\\\begin[ \t\n]*{[ \t\n]*document[ \t\n]*}"))        "\\\\begin[ \t\n]*{[ \t\n]*document[ \t\n]*}"))
1173      (;; delimited with \begin.  In ispell: displaymath, eqnarray, eqnarray*,      (;; delimited with \begin.  In ispell: displaymath, eqnarray, eqnarray*,
1174       ;; equation, minipage, picture, tabular, tabular* (ispell)       ;; equation, minipage, picture, tabular, tabular* (ispell)
1175       ("\\(figure\\|table\\)\\*?"  ispell-tex-arg-end 0)       ("\\(figure\\|table\\)\\*?"         ispell-tex-arg-end 0)
1176       ("list"                      ispell-tex-arg-end 2)       ("list"                             ispell-tex-arg-end 2)
1177       ("program"         . "\\\\end[ \t\n]*{[ \t\n]*program[ \t\n]*}")       ("program"         . "\\\\end[ \t\n]*{[ \t\n]*program[ \t\n]*}")
1178       ("verbatim\\*?"    . "\\\\end[ \t\n]*{[ \t\n]*verbatim\\*?[ \t\n]*}")))       ("verbatim\\*?"    . "\\\\end[ \t\n]*{[ \t\n]*verbatim\\*?[ \t\n]*}")))
1179    "*Lists of regions to be skipped in TeX mode.    "*Lists of regions to be skipped in TeX mode.
# Line 1135  Delete or add any regions you want to be Line 1184  Delete or add any regions you want to be
1184  for skipping in latex mode.")  for skipping in latex mode.")
1185    
1186    
1187    ;;;###autoload
1188    (defvar ispell-html-skip-alists
1189      '(("<[cC][oO][dD][eE]\\>[^>]*>"         "</[cC][oO][dD][eE]*>")
1190        ("<[sS][cC][rR][iI][pP][tT]\\>[^>]*>" "</[sS][cC][rR][iI][pP][tT]>")
1191        ("<[aA][pP][pP][lL][eE][tT]\\>[^>]*>" "</[aA][pP][pP][lL][eE][tT]>")
1192        ("<[vV][eE][rR][bB]\\>[^>]*>"         "<[vV][eE][rR][bB]\\>[^>]*>")
1193        ;;("<[tT][tT]\\>[^>]*>"               "<[tT][tT]\\>[^>]*>")
1194        ("<[tT][tT]/"                         "/")
1195        ("<[^ \t\n>]"                         ">")
1196        ("&[^ \t\n;]"                         "[; \t\n]"))
1197      "*Lists of start and end keys to skip in HTML buffers.
1198    Same format as `ispell-skip-region-alist'
1199    Note - substrings of other matches must come last
1200     (e.g. \"<[tT][tT]/\" and \"<[^ \t\n>]\").")
1201    
1202    
1203  (defvar ispell-local-pdict ispell-personal-dictionary  (defvar ispell-local-pdict ispell-personal-dictionary
1204    "A buffer local variable containing the current personal dictionary.    "A buffer local variable containing the current personal dictionary.
1205  If non-nil, the value must be a string, which is a file name.  If non-nil, the value must be a string, which is a file name.
# Line 1167  You can set this variable in hooks in yo Line 1232  You can set this variable in hooks in yo
1232  (defvar ispell-check-only nil  (defvar ispell-check-only nil
1233    "If non-nil, `ispell-word' does not try to correct the word.")    "If non-nil, `ispell-word' does not try to correct the word.")
1234    
1235    (defconst ispell-graphic-p
1236      (if (fboundp 'display-graphic-p)
1237          (display-graphic-p)
1238        xemacsp)
1239      "True if running on a `graphics capable' display.
1240    These displays have thicker mode lines that can partially cover text.")
1241    
1242    (if (fboundp 'mode-line-window-height-fudge)
1243        (defalias 'ispell-mode-line-window-height-fudge
1244          'mode-line-window-height-fudge)
1245      (defun ispell-mode-line-window-height-fudge ()
1246        "Return 1 if running on a `graphics capable' display, otherwise 0."
1247        (if ispell-graphic-p 1 0)))
1248    
1249    
1250  ;;; **********************************************************************  ;;; **********************************************************************
1251  ;;; **********************************************************************  ;;; **********************************************************************
# Line 1210  pass it the output of the last ispell in Line 1289  pass it the output of the last ispell in
1289      ;; terrible kludge, and it's a bit slow, but it does get the work done.)      ;; terrible kludge, and it's a bit slow, but it does get the work done.)
1290      (let ((cmd (aref string 0))      (let ((cmd (aref string 0))
1291            ;; The following commands are not passed to Ispell until            ;; The following commands are not passed to Ispell until
1292            ;; we have a *reall* reason to invoke it.            ;; we have a *real* reason to invoke it.
1293            (cmds-to-defer '(?* ?@ ?~ ?+ ?- ?! ?%))            (cmds-to-defer '(?* ?@ ?~ ?+ ?- ?! ?%))
1294            (default-major-mode 'fundamental-mode)            (default-major-mode 'fundamental-mode)
1295            (session-buf ispell-session-buffer)            (session-buf ispell-session-buffer)
# Line 1225  pass it the output of the last ispell in Line 1304  pass it the output of the last ispell in
1304          (insert string)          (insert string)
1305          (if (not (memq cmd cmds-to-defer))          (if (not (memq cmd cmds-to-defer))
1306              (let (coding-system-for-read coding-system-for-write status)              (let (coding-system-for-read coding-system-for-write status)
1307                (if (or xemacsp                (if (and (boundp 'enable-multibyte-characters)
1308                        (and (boundp 'enable-multibyte-characters)                         enable-multibyte-characters)
                            enable-multibyte-characters))  
1309                    (setq coding-system-for-read (ispell-get-coding-system)                    (setq coding-system-for-read (ispell-get-coding-system)
1310                          coding-system-for-write (ispell-get-coding-system)))                          coding-system-for-write (ispell-get-coding-system)))
1311                (set-buffer output-buf)                (set-buffer output-buf)
# Line 1297  This will check or reload the dictionary Line 1375  This will check or reload the dictionary
1375  or \\[ispell-region] to update the Ispell process.  or \\[ispell-region] to update the Ispell process.
1376    
1377  return values:  return values:
1378  nil           word is correct or spelling is accpeted.  nil           word is correct or spelling is accepted.
1379  0             word is inserted into buffer-local definitions.  0             word is inserted into buffer-local definitions.
1380  \"word\"        word corrected from word list.  \"word\"        word corrected from word list.
1381  \(\"word\" arg\)  word is hand entered.  \(\"word\" arg\)  word is hand entered.
# Line 1339  quit          spell session exited." Line 1417  quit          spell session exited."
1417          (cond ((eq poss t)          (cond ((eq poss t)
1418                 (or quietly                 (or quietly
1419                     (message "%s is correct"                     (message "%s is correct"
1420                              (funcall ispell-format-word word))))                              (funcall ispell-format-word word)))
1421                   (and (fboundp 'extent-at)
1422                        (extent-at start)
1423                        (delete-extent (extent-at start))))
1424                ((stringp poss)                ((stringp poss)
1425                 (or quietly                 (or quietly
1426                     (message "%s is correct because of root %s"                     (message "%s is correct because of root %s"
1427                              (funcall ispell-format-word word)                              (funcall ispell-format-word word)
1428                              (funcall ispell-format-word poss))))                              (funcall ispell-format-word poss)))
1429                   (and (fboundp 'extent-at)
1430                        (extent-at start)
1431                        (delete-extent (extent-at start))))
1432                ((null poss) (message "Error in ispell process"))                ((null poss) (message "Error in ispell process"))
1433                (ispell-check-only        ; called from ispell minor mode.                (ispell-check-only        ; called from ispell minor mode.
1434                 (beep)                 (if (fboundp 'make-extent)
1435                 (message "%s is incorrect" (funcall ispell-format-word word)))                     (let ((ext (make-extent start end)))
1436                         (set-extent-property ext 'face ispell-highlight-face)
1437                         (set-extent-property ext 'priority 2000))
1438                     (beep)
1439                     (message "%s is incorrect"(funcall ispell-format-word word))))
1440                (t                        ; prompt for correct word.                (t                        ; prompt for correct word.
1441                 (save-window-excursion                 (save-window-excursion
1442                   (setq replace (ispell-command-loop                   (setq replace (ispell-command-loop
# Line 1454  Word syntax described by `ispell-diction Line 1542  Word syntax described by `ispell-diction
1542  ;;; a value or a list, whose value is the state of whether the  ;;; a value or a list, whose value is the state of whether the
1543  ;;; dictionary needs to be saved.  ;;; dictionary needs to be saved.
1544    
1545  ;;; ###autoload  ;;;###autoload
1546  (defun ispell-pdict-save (&optional no-query force-save)  (defun ispell-pdict-save (&optional no-query force-save)
1547    "Check to see if the personal dictionary has been modified.    "Check to see if the personal dictionary has been modified.
1548  If so, ask if it needs to be saved."  If so, ask if it needs to be saved."
# Line 1470  If so, ask if it needs to be saved." Line 1558  If so, ask if it needs to be saved."
1558    (setq ispell-pdict-modified-p nil))    (setq ispell-pdict-modified-p nil))
1559    
1560    
1561    (defun ispell-choices-win-default-height ()
1562      "Return the default height of the `*Choices*' window for this display.
1563    This is the value of of the variable `ispell-choices-win-default-height',
1564    plus a possible fudge factor to work around problems with mode-lines that
1565    obscure the last buffer line on graphics capable displays."
1566      (+ ispell-choices-win-default-height (ispell-mode-line-window-height-fudge)))
1567    
1568    
1569  (defun ispell-command-loop (miss guess word start end)  (defun ispell-command-loop (miss guess word start end)
1570    "Display possible corrections from list MISS.    "Display possible corrections from list MISS.
1571  GUESS lists possibly valid affix construction of WORD.  GUESS lists possibly valid affix construction of WORD.
# Line 1485  indicates whether the dictionary has bee Line 1581  indicates whether the dictionary has bee
1581  used.  used.
1582  Global `ispell-quit' set to start location to continue spell session."  Global `ispell-quit' set to start location to continue spell session."
1583    (let ((count ?0)    (let ((count ?0)
1584          (line ispell-choices-win-default-height)          (line (ispell-choices-win-default-height))
1585          (max-lines (- (window-height) 4)) ; ensure 4 context lines.          (max-lines (- (window-height) 4)) ; ensure 4 context lines.
1586          (choices miss)          (choices miss)
1587          (window-min-height (min window-min-height          (window-min-height (min window-min-height
1588                                  ispell-choices-win-default-height))                                  (ispell-choices-win-default-height)))
1589          (command-characters '( ?  ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m ))          (command-characters '( ?  ?i ?a ?A ?r ?R ?? ?x ?X ?q ?l ?u ?m ))
1590          (dedicated (window-dedicated-p (selected-window)))          (dedicated (window-dedicated-p (selected-window)))
1591          (skipped 0)          (skipped 0)
# Line 1499  Global `ispell-quit' set to start locati Line 1595  Global `ispell-quit' set to start locati
1595      (save-excursion      (save-excursion
1596        (set-buffer (get-buffer-create ispell-choices-buffer))        (set-buffer (get-buffer-create ispell-choices-buffer))
1597        (setq mode-line-format (concat "--  %b  --  word: " word))        (setq mode-line-format (concat "--  %b  --  word: " word))
1598        ;; XEmacs: prevent thick modeline vs increasing height in overlay-window        ;; XEmacs: no need for horizontal scrollbar in choices window
1599        ;;(and (fboundp 'set-specifier)        (and (fboundp 'set-specifier)
1600        ;;     (set-specifier has-modeline-p (cons (current-buffer) nil)))             (boundp 'horizontal-scrollbar-visible-p)
1601               (set-specifier horizontal-scrollbar-visible-p nil
1602                              (cons (current-buffer) nil)))
1603        (erase-buffer)        (erase-buffer)
1604        (if guess        (if guess
1605            (progn            (progn
# Line 1660  Global `ispell-quit' set to start locati Line 1758  Global `ispell-quit' set to start locati
1758                                                        new-word)                                                        new-word)
1759                                      miss (lookup-words new-word)                                      miss (lookup-words new-word)
1760                                      choices miss                                      choices miss
1761                                      line ispell-choices-win-default-height)                                      line (ispell-choices-win-default-height))
1762                                (while (and choices ; adjust choices window.                                (while (and choices ; adjust choices window.
1763                                            (< (if (> (+ 7 (current-column)                                            (< (if (> (+ 7 (current-column)
1764                                                         (length (car choices))                                                         (length (car choices))
# Line 1762  Global `ispell-quit' set to start locati Line 1860  Global `ispell-quit' set to start locati
1860              ;; without scrolling the spelled window when possible              ;; without scrolling the spelled window when possible
1861              (let ((window-line (- line (window-height choices-window)))              (let ((window-line (- line (window-height choices-window)))
1862                    (visible (progn (vertical-motion -1) (point))))                    (visible (progn (vertical-motion -1) (point))))
1863                (if (< line ispell-choices-win-default-height)                (if (< line (ispell-choices-win-default-height))
1864                    (setq window-line (+ window-line                    (setq window-line (+ window-line
1865                                         (- ispell-choices-win-default-height                                         (- (ispell-choices-win-default-height)
1866                                            line))))                                            line))))
1867                (move-to-window-line 0)                (move-to-window-line 0)
1868                (vertical-motion window-line)                (vertical-motion window-line)
1869                (set-window-start (selected-window)                (set-window-start (selected-window)
1870                                  (if (> (point) visible) visible (point)))                                  (if (> (point) visible) visible (point)))
1871                (goto-char end)                (goto-char end)
1872                (select-window (previous-window)) ; *Choices* window                (select-window choices-window)
1873                (enlarge-window window-line)))                (enlarge-window window-line)))
1874          ;; Overlay *Choices* window when it isn't showing          ;; Overlay *Choices* window when it isn't showing
1875          (ispell-overlay-window (max line ispell-choices-win-default-height)))          (ispell-overlay-window (max line (ispell-choices-win-default-height))))
1876        (switch-to-buffer ispell-choices-buffer)        (switch-to-buffer ispell-choices-buffer)
1877        (goto-char (point-min)))))        (goto-char (point-min)))))
1878    
# Line 1847  SPC:   Accept word this time. Line 1945  SPC:   Accept word this time.
1945        (save-window-excursion        (save-window-excursion
1946          (if ispell-help-in-bufferp          (if ispell-help-in-bufferp
1947              (progn              (progn
1948                (ispell-overlay-window (if xemacsp 5 4))                (ispell-overlay-window
1949                   (+ 4 (ispell-mode-line-window-height-fudge)))
1950                (switch-to-buffer (get-buffer-create "*Ispell Help*"))                (switch-to-buffer (get-buffer-create "*Ispell Help*"))
1951                (insert (concat help-1 "\n" help-2 "\n" help-3))                (insert (concat help-1 "\n" help-2 "\n" help-3))
1952                (sit-for 5)                (sit-for 5)
1953                (kill-buffer "*Ispell Help*"))                (kill-buffer "*Ispell Help*"))
1954            (select-window (minibuffer-window))            (unwind-protect
1955            (erase-buffer)                (progn
1956            (if (not version18p) (message nil))                  (select-window (minibuffer-window))
1957            ;;(set-minibuffer-window (selected-window))                  (erase-buffer)
1958            (enlarge-window 2)                  (if (not version18p) (message nil))
1959            (insert (concat help-1 "\n" help-2 "\n" help-3))                  ;;(set-minibuffer-window (selected-window))
1960            (sit-for 5)                  (enlarge-window 2)
1961            (erase-buffer))))))                  (insert (concat help-1 "\n" help-2 "\n" help-3))
1962                    (sit-for 5))
1963                (erase-buffer)))))))
1964    
1965    
1966  (defun lookup-words (word &optional lookup-dict)  (defun lookup-words (word &optional lookup-dict)
# Line 2037  The variable `ispell-highlight-face' sel Line 2138  The variable `ispell-highlight-face' sel
2138  Ensure that the line above point is still visible but otherwise avoid  Ensure that the line above point is still visible but otherwise avoid
2139  scrolling the current window.  Leave the new window selected."  scrolling the current window.  Leave the new window selected."
2140    (save-excursion    (save-excursion
2141      (let ((oldot (save-excursion (forward-line -1) (point)))      (let ((oldot (save-excursion (vertical-motion -1) (point)))
2142            (top (save-excursion (move-to-window-line height) (point))))            (top (save-excursion (move-to-window-line height) (point))))
2143        ;; If line above old point (line starting at oldot) would be        ;; If line above old point (line starting at oldot) would be
2144        ;; hidden by new window, scroll it to just below new win        ;; hidden by new window, scroll it to just below new win
# Line 2065  scrolling the current window.  Leave the Line 2166  scrolling the current window.  Leave the
2166     MISS-LIST and GUESS-LIST are possibly null lists of guesses and misses.     MISS-LIST and GUESS-LIST are possibly null lists of guesses and misses.
2167  4: Nil when an error has occurred.  4: Nil when an error has occurred.
2168    
2169  Optinal second arg ACCEPT-LIST is list of words already accepted.  Optional second arg ACCEPT-LIST is list of words already accepted.
2170  Optional third arg SHIFT is an offset to apply based on previous corrections."  Optional third arg SHIFT is an offset to apply based on previous corrections."
2171    (cond    (cond
2172     ((string= output "") t)              ; for startup with pipes...     ((string= output "") t)              ; for startup with pipes...
# Line 2164  Keeps argument list for future ispell in Line 2265  Keeps argument list for future ispell in
2265      (ispell-kill-ispell t)      (ispell-kill-ispell t)
2266      (message "Starting new Ispell process...")      (message "Starting new Ispell process...")
2267      (sit-for 0)      (sit-for 0)
2268      (check-ispell-version)      (setq ispell-library-path (check-ispell-version)
2269      (setq ispell-process-directory default-directory            ispell-process-directory default-directory
2270            ispell-process (ispell-start-process)            ispell-process (ispell-start-process)
2271            ispell-filter nil            ispell-filter nil
2272            ispell-filter-continue nil)            ispell-filter-continue nil)
# Line 2254  A new one will be started as soon as nec Line 2355  A new one will be started as soon as nec
2355    
2356  By just answering RET you can find out what the current dictionary is.  By just answering RET you can find out what the current dictionary is.
2357    
2358  With prefix argument, set the default directory."  With prefix argument, set the default dictionary."
2359    (interactive    (interactive
2360     (list (completing-read     (list (completing-read
2361            "Use new dictionary (RET for current, SPC to complete): "            "Use new dictionary (RET for current, SPC to complete): "
# Line 2302  Return nil if spell session is quit, Line 2403  Return nil if spell session is quit,
2403    (interactive "r")                     ; Don't flag errors on read-only bufs.    (interactive "r")                     ; Don't flag errors on read-only bufs.
2404    (if (not recheckp)    (if (not recheckp)
2405        (ispell-accept-buffer-local-defs)) ; set up dictionary, local words, etc.        (ispell-accept-buffer-local-defs)) ; set up dictionary, local words, etc.
2406      (let ((skip-region-start (make-marker))
2407            (rstart (make-marker)))
2408    (unwind-protect    (unwind-protect
2409        (save-excursion        (save-excursion
2410          (message "Spell checking %s using %s dictionary..."          (message "Spell checking %s using %s dictionary..."
# Line 2313  Return nil if spell session is quit, Line 2416  Return nil if spell session is quit,
2416            (goto-char reg-start)            (goto-char reg-start)
2417            (let ((transient-mark-mode)            (let ((transient-mark-mode)
2418                  (case-fold-search case-fold-search)                  (case-fold-search case-fold-search)
2419                  (skip-region-start (make-marker))                  (query-fcc t)
2420                  (skip-regexp (ispell-begin-skip-region-regexp))                  in-comment
                 (skip-alist ispell-skip-region-alist)  
2421                  key)                  key)
             (if (eq ispell-parser 'tex)  
                 (setq case-fold-search nil  
                       skip-alist  
                       (append (car ispell-tex-skip-alists)  
                               (car (cdr ispell-tex-skip-alists))  
                               skip-alist)))  
2422              (let (message-log-max)              (let (message-log-max)
2423                (message "searching for regions to skip"))                (message "searching for regions to skip"))
2424              (if (re-search-forward skip-regexp reg-end t)              (if (re-search-forward (ispell-begin-skip-region-regexp) reg-end t)
2425                  (progn                  (progn
2426                    (setq key (buffer-substring-no-properties                    (setq key (buffer-substring-no-properties
2427                               (match-beginning 0) (match-end 0)))                               (match-beginning 0) (match-end 0)))
# Line 2334  Return nil if spell session is quit, Line 2430  Return nil if spell session is quit,
2430              (let (message-log-max)              (let (message-log-max)
2431                (message "Continuing spelling check using %s dictionary..."                (message "Continuing spelling check using %s dictionary..."
2432                         (or ispell-dictionary "default")))                         (or ispell-dictionary "default")))
2433                (set-marker rstart reg-start)
2434              (set-marker ispell-region-end reg-end)              (set-marker ispell-region-end reg-end)
2435              (while (and (not ispell-quit)              (while (and (not ispell-quit)
2436                          (< (point) ispell-region-end))                          (< (point) ispell-region-end))
# Line 2341  Return nil if spell session is quit, Line 2438  Return nil if spell session is quit,
2438                (if (and (marker-position skip-region-start)                (if (and (marker-position skip-region-start)
2439                         (<= skip-region-start (point)))                         (<= skip-region-start (point)))
2440                    (progn                    (progn
2441                      (ispell-skip-region key skip-alist) ; moves pt past region.                      ;; If region inside line comment, must keep comment start.
2442                      (setq reg-start (point))                      (setq in-comment (point)
2443                      (if (and (< reg-start ispell-region-end)                            in-comment
2444                               (re-search-forward skip-regexp                            (and comment-start
2445                                                  ispell-region-end t))                                 (or (null comment-end) (string= "" comment-end))
2446                                   (save-excursion
2447                                     (beginning-of-line)
2448                                     (re-search-forward comment-start in-comment t))
2449                                   comment-start))
2450                        ;; Can change skip-regexps (in ispell-message)
2451                        (ispell-skip-region key) ; moves pt past region.
2452                        (set-marker rstart (point))
2453                        ;; check for saving large attachments...
2454                        (setq query-fcc (and query-fcc
2455                                             (ispell-ignore-fcc skip-region-start
2456                                                                rstart)))
2457                        (if (and (< rstart ispell-region-end)
2458                                 (re-search-forward
2459                                  (ispell-begin-skip-region-regexp)
2460                                  ispell-region-end t))
2461                          (progn                          (progn
2462                            (setq key (buffer-substring-no-properties                            (setq key (buffer-substring-no-properties
2463                                       (car (match-data))                                       (car (match-data))
2464                                       (car (cdr (match-data)))))                                       (car (cdr (match-data)))))
2465                            (set-marker skip-region-start                            (set-marker skip-region-start
2466                                        (- (point) (length key)))                                        (- (point) (length key)))
2467                            (goto-char reg-start))                            (goto-char rstart))
2468                        (set-marker skip-region-start nil))))                        (set-marker skip-region-start nil))))
2469                (setq reg-end (if (marker-position skip-region-start)                (setq reg-end (max (point)
2470                                  (min skip-region-start ispell-region-end)                                   (if (marker-position skip-region-start)
2471                                (marker-position ispell-region-end)))                                       (min skip-region-start ispell-region-end)
2472                                       (marker-position ispell-region-end))))
2473                (let* ((start (point))                (let* ((start (point))
2474                       (end (save-excursion (end-of-line) (min (point) reg-end)))                       (end (save-excursion (end-of-line) (min (point) reg-end)))
2475                       (string (ispell-get-line start end reg-end)))                       (string (ispell-get-line start end reg-end in-comment)))
2476                    (if in-comment          ; account for comment chars added
2477                        (setq start (- start (length in-comment))
2478                              in-comment nil))
2479                  (setq end (point))      ; "end" tracks region retrieved.                  (setq end (point))      ; "end" tracks region retrieved.
2480                  (if string              ; there is something to spell check!                  (if string              ; there is something to spell check!
2481                      ;; (special start end)                      ;; (special start end)
# Line 2373  Return nil if spell session is quit, Line 2489  Return nil if spell session is quit,
2489      (if (and (not (and recheckp ispell-keep-choices-win))      (if (and (not (and recheckp ispell-keep-choices-win))
2490               (get-buffer ispell-choices-buffer))               (get-buffer ispell-choices-buffer))
2491          (kill-buffer ispell-choices-buffer))          (kill-buffer ispell-choices-buffer))
2492        (set-marker skip-region-start nil)
2493        (set-marker rstart nil)
2494      (if ispell-quit      (if ispell-quit
2495          (progn          (progn
2496            ;; preserve or clear the region for ispell-continue.            ;; preserve or clear the region for ispell-continue.
# Line 2389  Return nil if spell session is quit, Line 2507  Return nil if spell session is quit,
2507        (if (not recheckp) (set-marker ispell-region-end nil))        (if (not recheckp) (set-marker ispell-region-end nil))
2508        ;; Only save if successful exit.        ;; Only save if successful exit.
2509        (ispell-pdict-save ispell-silently-savep)        (ispell-pdict-save ispell-silently-savep)
2510        (message "Spell-checking done"))))        (message "Spell-checking done")))))
2511    
2512    
 ;;; Creates the regexp for skipping a region.  
 ;;; Makes the skip-regexp local for tex buffers adding in the  
 ;;; tex expressions to skip as well.  
 ;;; Call AFTER ispell-buffer-local-parsing.  
2513  (defun ispell-begin-skip-region-regexp ()  (defun ispell-begin-skip-region-regexp ()
2514    (let ((skip-regexp (ispell-begin-skip-region)))    "Returns a regexp of the search keys for region skipping.
2515    Includes `ispell-skip-region-alist' plus tex, tib, html, and comment keys.
2516    Must call after ispell-buffer-local-parsing due to dependence on mode."
2517      ;; start with regions generic to all buffers
2518      (let ((skip-regexp (ispell-begin-skip-region ispell-skip-region-alist)))
2519        ;; Comments
2520      (if (and (null ispell-check-comments) comment-start)      (if (and (null ispell-check-comments) comment-start)
2521          (setq skip-regexp (concat (regexp-quote comment-start) "\\|"          (setq skip-regexp (concat (regexp-quote comment-start) "\\|"
2522                                    skip-regexp)))                                    skip-regexp)))
2523      (if (and (eq 'exclusive ispell-check-comments) comment-start)      (if (and (eq 'exclusive ispell-check-comments) comment-start)
2524            ;; search from end of current comment to start of next comment.
2525          (setq skip-regexp (concat (if (string= "" comment-end) "^"          (setq skip-regexp (concat (if (string= "" comment-end) "^"
2526                                      (regexp-quote comment-end))                                      (regexp-quote comment-end))
2527                                    "\\|" skip-regexp)))                                    "\\|" skip-regexp)))
2528        ;; tib
2529      (if ispell-skip-tib      (if ispell-skip-tib
2530          (setq skip-regexp (concat ispell-tib-ref-beginning "\\|" skip-regexp)))          (setq skip-regexp (concat ispell-tib-ref-beginning "\\|" skip-regexp)))
2531        ;; html stuff
2532      (if ispell-skip-html      (if ispell-skip-html
2533          (setq skip-regexp (concat "<[cC][oO][dD][eE]\\>[^>]*>" "\\|"          (setq skip-regexp (concat
2534                                    "<[sS][cC][rR][iI][pP][tT]\\>[^>]*>" "\\|"                             (ispell-begin-skip-region ispell-html-skip-alists)
2535                                    "<[aA][pP][pP][lL][eE][tT]\\>[^>]*>" "\\|"                             "\\|"
2536                                    "<[vV][eE][rR][bB]\\>[^>]*>" "\\|"                             skip-regexp)))
2537                                    ;; "<[tT][tT]\\>[^>]*>" "\\|"      ;; tex
                                   "<[tT][tT]/" "\\|"  
                                   "<" "\\|"  
                                   "&" "\\|"  
                                   skip-regexp)))  
2538      (if (eq ispell-parser 'tex)      (if (eq ispell-parser 'tex)
2539          (setq skip-regexp (concat (ispell-begin-tex-skip-regexp) "\\|"          (setq skip-regexp (concat (ispell-begin-tex-skip-regexp) "\\|"
2540                                    skip-regexp)))                                    skip-regexp)))
2541        ;; messages
2542        (if (and ispell-checking-message
2543                 (not (eq t ispell-checking-message)))
2544            (setq skip-regexp (concat
2545                               (mapconcat
2546                                (function (lambda (lst) (car lst)))
2547                                ispell-checking-message
2548                                "\\|")
2549                               "\\|"
2550                               skip-regexp)))
2551    
2552        ;; return new regexp
2553      skip-regexp))      skip-regexp))
2554    
2555    
2556    (defun ispell-begin-skip-region (skip-alist)
2557      "Regular expression for start of regions to skip generated from SKIP-ALIST.
2558    Each selection should be a key of SKIP-ALIST;
2559    otherwise, the current line is skipped."
2560      (mapconcat (function (lambda (lst)
2561                             (if (stringp (car lst))
2562                                 (car lst)
2563                               (eval (car lst)))))
2564                 skip-alist
2565                 "\\|"))
2566    
2567    
2568  (defun ispell-begin-tex-skip-regexp ()  (defun ispell-begin-tex-skip-regexp ()
2569    "Regular expression of tex commands to skip.    "Regular expression of tex commands to skip.
2570  Generated from `ispell-tex-skip-alists'."  Generated from `ispell-tex-skip-alists'."
2571    (concat    (concat
2572       ;; raw tex keys
2573     (mapconcat (function (lambda (lst) (car lst)))     (mapconcat (function (lambda (lst) (car lst)))
2574                (car ispell-tex-skip-alists)                (car ispell-tex-skip-alists)
2575                "\\|")                "\\|")
2576     "\\|"     "\\|"
2577       ;; keys wrapped in begin{}
2578     (mapconcat (function (lambda (lst)     (mapconcat (function (lambda (lst)
2579                            (concat "\\\\begin[ \t\n]*{[ \t\n]*"                            (concat "\\\\begin[ \t\n]*{[ \t\n]*"
2580                                    (car lst)                                    (car lst)
# Line 2439  Generated from `ispell-tex-skip-alists'. Line 2583  Generated from `ispell-tex-skip-alists'.
2583                "\\|")))                "\\|")))
2584    
2585    
2586  (defun ispell-begin-skip-region ()  (defun ispell-skip-region-list ()
2587    "Regular expression of regions to skip for all buffers.    "Returns a list describing key and body regions to skip for this buffer.
2588  Each selection should be a key of `ispell-skip-region-alist';  Includes regions defined by `ispell-skip-region-alist', tex mode,
2589  otherwise, the current line is skipped."  `ispell-html-skip-alists', and `ispell-checking-message'.
2590    (mapconcat (function (lambda (lst) (if (stringp (car lst)) (car lst)  Manual checking must include comments and tib references.
2591                                          (eval (car lst)))))  The list is of the form described by variable `ispell-skip-region-alist'.
2592               ispell-skip-region-alist  Must call after `ispell-buffer-local-parsing' due to dependence on mode."
2593               "\\|"))    (let ((skip-alist ispell-skip-region-alist))
2594        ;; only additional explicit region definition is tex.
2595        (if (eq ispell-parser 'tex)
2596            (setq case-fold-search nil
2597                  skip-alist (append (car ispell-tex-skip-alists)
2598                                     (car (cdr ispell-tex-skip-alists))
2599                                     skip-alist)))
2600        (if ispell-skip-html
2601            (setq skip-alist (append ispell-html-skip-alists skip-alist)))
2602        (if (and ispell-checking-message
2603                 (not (eq t ispell-checking-message)))
2604            (setq skip-alist (append ispell-checking-message skip-alist)))
2605        skip-alist))
2606    
2607    
2608  (defun ispell-tex-arg-end (&optional arg)  (defun ispell-tex-arg-end (&optional arg)
2609      "Skip across ARG number of braces."
2610    (condition-case nil    (condition-case nil
2611        (progn        (progn
2612          (while (looking-at "[ \t\n]*\\[") (forward-sexp))          (while (looking-at "[ \t\n]*\\[") (forward-sexp))
# Line 2460  otherwise, the current line is skipped." Line 2617  otherwise, the current line is skipped."
2617       (sit-for 2))))       (sit-for 2))))
2618    
2619    
2620  ;;; Skips to region-end from point, or a single line.  (defun ispell-ignore-fcc (start end)
2621  ;;; Places point at end of region skipped.    "Deletes the Fcc: message header when large attachments are included.
2622  (defun ispell-skip-region (key alist)  Return value `nil' if file with large attachments are saved.
2623    This can be used to avoid multiple quesitons for multiple large attachments.
2624    Returns point to starting location afterwards."
2625      (let ((result t))
2626        (if (and ispell-checking-message ispell-message-fcc-skip)
2627            (if (< ispell-message-fcc-skip (- end start))
2628                (let (case-fold-search head-end)
2629                  (goto-char (point-min))
2630                  (setq head-end
2631                        (or (re-search-forward
2632                             (concat "^" (regexp-quote mail-header-separator) "$")
2633                             nil t)
2634                            (re-search-forward "^$" nil t)
2635                            (point-min)))
2636                  (goto-char (point-min))
2637                  (if (re-search-forward "^Fcc:" head-end t)
2638                      (if (y-or-n-p
2639                           "Save copy of this message with large attachments? ")
2640                          (setq result nil)
2641                        (beginning-of-line)
2642                        (kill-line 1)))
2643                  (goto-char end))))
2644        result))
2645    
2646    
2647    (defun ispell-skip-region (key)
2648      "Skips across KEY and then to end of region.
2649    Key lookup determines region to skip.
2650    Point is placed at end of skipped region."
2651    ;; move over key to begin checking.    ;; move over key to begin checking.
2652    (forward-char (length key))    (forward-char (length key))
2653    (let ((start (point))    (let ((start (point))
2654            ;; Regenerate each call... This function can change region definition.
2655            (alist (ispell-skip-region-list))
2656          alist-key null-skip)          alist-key null-skip)
2657      (cond      (cond
2658       ;; what about quoted comment, or comment inside strings?       ;; what about quoted comment, or comment inside strings?
# Line 2479  otherwise, the current line is skipped." Line 2666  otherwise, the current line is skipped."
2666        (search-forward comment-start ispell-region-end :end))        (search-forward comment-start ispell-region-end :end))
2667       ((and ispell-skip-tib (string-match ispell-tib-ref-beginning key))       ((and ispell-skip-tib (string-match ispell-tib-ref-beginning key))
2668        (re-search-forward ispell-tib-ref-end ispell-region-end t))        (re-search-forward ispell-tib-ref-end ispell-region-end t))
      ((and ispell-skip-html (string-match "</" key))  
       (search-forward ">" ispell-region-end t))  
      ((and ispell-skip-html (string-match "<[cC][oO][dD][eE]\\>[^>]*>" key))  
       (search-forward-regexp "</[cC][oO][dD][eE]>" ispell-region-end t))  
      ((and ispell-skip-html  
            (string-match "<[sS][cC][rR][iI][pP][tT]\\>[^>]*>" key))  
       (search-forward-regexp "</[sS][cC][rR][iI][pP][tT]>" ispell-region-end t))  
      ((and ispell-skip-html  
            (string-match "<[aA][pP][pP][lL][eE][tT]\\>[^>]*>" key))  
       (search-forward-regexp "</[aA][pP][pP][lL][eE][tT]>" ispell-region-end t))  
      ((and ispell-skip-html (string-match "<[vV][eE][rR][bB]\\>[^>]*>" key))  
       (search-forward-regexp "</[vV][eE][rR][bB]>" ispell-region-end t))  
      ;;((and ispell-skip-html (string-match "<[tT][tT]\\>[^>]*>" key))  
      ;; (search-forward-regexp "</[tT][tT]>" ispell-region-end t))  
      ((and ispell-skip-html (string-match "<[tT][tT]/" key))  
       (search-forward "/" ispell-region-end t))  
      ((and ispell-skip-html (string-match "<" key))  
       (search-forward ">" ispell-region-end t))  
      ((and ispell-skip-html (string-match "&" key))  
       (search-forward-regexp "[; \t\n]" ispell-region-end t))  
2669       ;; markings from alist       ;; markings from alist
2670       (t       (t
2671        (while alist        (while alist
# Line 2511  otherwise, the current line is skipped." Line 2678  otherwise, the current line is skipped."
2678                 ((not (consp alist))                 ((not (consp alist))
2679                  ;; Search past end of spell region to find this region end.                  ;; Search past end of spell region to find this region end.
2680                  (re-search-forward (eval alist) (point-max) t))                  (re-search-forward (eval alist) (point-max) t))
2681                 ((consp alist)                 ((and (= 1 (length alist))
2682                  (if (stringp alist)                       (stringp (car alist)))
2683                      (re-search-forward alist (point-max) t)                  (re-search-forward (car alist) (point-max) t))
2684                    (setq null-skip t)    ; error handling in functions!                 (t
2685                    (if (consp (cdr alist))                  (setq null-skip t)      ; error handling in functions!
2686                        (apply (car alist) (cdr alist))                  (if (consp (cdr alist))
2687                      (funcall (car alist))))))                      (apply (car alist) (cdr alist))
2688                      (funcall (car alist)))))
2689                (setq alist nil))                (setq alist nil))
2690            (setq alist (cdr alist))))))            (setq alist (cdr alist))))))
2691      (if (and (= start (point)) (null null-skip))      (if (and (= start (point)) (null null-skip))
# Line 2530  otherwise, the current line is skipped." Line 2698  otherwise, the current line is skipped."
2698    
2699  ;;; Grab the next line of data.  ;;; Grab the next line of data.
2700  ;;; Returns a string with the line data  ;;; Returns a string with the line data
2701  (defun ispell-get-line (start end reg-end)  (defun ispell-get-line (start end reg-end in-comment)
2702    (let ((ispell-casechars (ispell-get-casechars))    (let ((ispell-casechars (ispell-get-casechars))
2703          string)          string)
2704      (cond                               ; LOOK AT THIS LINE AND SKIP OR PROCESS      (cond                               ; LOOK AT THIS LINE AND SKIP OR PROCESS
# Line 2540  otherwise, the current line is skipped." Line 2708  otherwise, the current line is skipped."
2708       ;; (forward-char 1))               ; not needed as quoted below.       ;; (forward-char 1))               ; not needed as quoted below.
2709       ((or (re-search-forward ispell-casechars end t) ; TEXT EXISTS       ((or (re-search-forward ispell-casechars end t) ; TEXT EXISTS
2710            (re-search-forward "[][()${}]" end t)) ; or MATH COMMANDS            (re-search-forward "[][()${}]" end t)) ; or MATH COMMANDS
2711        (setq string (concat "^" (buffer-substring-no-properties start end)        (setq string (concat "^" in-comment
2712                               (buffer-substring-no-properties start end)
2713                             "\n"))                             "\n"))
2714        (goto-char end))        (goto-char end))
2715       (t (goto-char end)))               ; EMPTY LINE, skip it.       (t (goto-char end)))               ; EMPTY LINE, skip it.
# Line 2592  Returns the sum shift due to changes in Line 2761  Returns the sum shift due to changes in
2761              (ispell-horiz-scroll)              (ispell-horiz-scroll)
2762              (goto-char word-start)              (goto-char word-start)
2763              (ispell-horiz-scroll)              (ispell-horiz-scroll)
2764    
2765              ;; Alignment cannot be tracked and this error will occur when              ;; Alignment cannot be tracked and this error will occur when
2766              ;; `query-replace' makes multiple corrections on the starting line.              ;; `query-replace' makes multiple corrections on the starting line.
2767              (if (/= (+ word-len (point))              (if (/= (+ word-len (point))
# Line 2681  Returns the sum shift due to changes in Line 2851  Returns the sum shift due to changes in
2851                ;; Move line-start across word...                ;; Move line-start across word...
2852                ;; new shift function does this now...                ;; new shift function does this now...
2853                ;;(set-marker line-start (+ line-start                ;;(set-marker line-start (+ line-start
2854                  ;;                      (- (length replace)                ;;                        (- (length replace)
2855                  ;;                         (length (car poss)))))                ;;                           (length (car poss)))))
2856                ))                ))
2857              (if (not ispell-quit)              (if (not ispell-quit)
2858                  (let (message-log-max)                  (let (message-log-max)
# Line 2831  Standard ispell choices are then availab Line 3001  Standard ispell choices are then availab
3001    (ispell-complete-word t))    (ispell-complete-word t))
3002    
3003    
3004    ;;;###autoload
3005    (defun ispell ()
3006      "Interactively check a region or buffer for spelling errors.
3007    If `transient-mark-mode' is on, and a region is active, spell-check
3008    that region.  Otherwise spell-check the buffer.
3009    
3010    Ispell dictionaries are not distributed with Emacs.  If you are
3011    looking for a dictionary, please see the distribution of the GNU ispell
3012    program, or do an Internet search; there are various dictionaries
3013    available on the net."
3014      (interactive)
3015      (if (and (boundp 'transient-mark-mode) transient-mark-mode
3016               (boundp 'mark-active) mark-active)
3017          (ispell-region (region-beginning) (region-end))
3018        (ispell-buffer)))
3019    
3020    
3021  ;;; **********************************************************************  ;;; **********************************************************************
3022  ;;;                     Ispell Minor Mode  ;;;                     Ispell Minor Mode
3023  ;;; **********************************************************************  ;;; **********************************************************************
# Line 2891  Don't read buffer-local settings or word Line 3078  Don't read buffer-local settings or word
3078  ;;; **********************************************************************  ;;; **********************************************************************
3079  ;;;                     Ispell Message  ;;;                     Ispell Message
3080  ;;; **********************************************************************  ;;; **********************************************************************
 ;;; Original from D. Quinlan, E. Bradford, A. Albert, and M. Ernst  
3081    
3082    
3083  (defvar ispell-message-text-end  (defvar ispell-message-text-end
# Line 2900  Don't read buffer-local settings or word Line 3086  Don't read buffer-local settings or word
3086                 ;; Don't spell check signatures                 ;; Don't spell check signatures
3087                 "^-- $"                 "^-- $"
3088                 ;; Matches postscript files.                 ;; Matches postscript files.
3089                 "^%!PS-Adobe-[123].0"                 ;;"^%!PS-Adobe-[123].0"
3090                 ;; Matches uuencoded text                 ;; Matches uuencoded text
3091                 "^begin [0-9][0-9][0-9] .*\nM.*\nM.*\nM"                 ;;"^begin [0-9][0-9][0-9] .*\nM.*\nM.*\nM"
3092                 ;; Matches shell files (especially auto-decoding)                 ;; Matches shell files (especially auto-decoding)
3093                 "^#! /bin/[ck]?sh"                 "^#! /bin/[ck]?sh"
3094                 ;; Matches context difference listing                 ;; Matches context difference listing
# Line 2919  If it is a string, limit at first occurr Line 3105  If it is a string, limit at first occurr
3105  Otherwise, it must be a function which is called to get the limit.")  Otherwise, it must be a function which is called to get the limit.")
3106    
3107    
3108    (defun ispell-mime-multipartp (&optional limit)
3109      "Return multipart message start boundary or nil if none."
3110      ;; caller must ensure `case-fold-search' is set to `t'
3111      (and
3112       (re-search-forward
3113        "Content-Type: *multipart/\\([^ \t\n]*;[ \t]*[\n]?[ \t]*\\)+boundary="
3114        limit t)
3115       (let (boundary)
3116         (if (looking-at "\"")
3117             (let (start)
3118               (forward-char)
3119               (setq start (point))
3120               (while (not (looking-at "\""))
3121                 (forward-char 1))
3122               (setq boundary (buffer-substring-no-properties start (point))))
3123           (let ((start (point)))
3124             (while (looking-at "[-0-9a-zA-Z'()+_,./:=?]")
3125               (forward-char))
3126             (setq boundary (buffer-substring-no-properties start (point)))))
3127         (if (< (length boundary) 1)
3128             (setq boundary nil)
3129           (concat "--" boundary)))))
3130    
3131    
3132    (defun ispell-mime-skip-part (boundary)
3133      "Moves point across header, or entire MIME part if message is encoded.
3134    All specified types except `7bit' `8bit' and `quoted-printable' are considered
3135    encoded and therefore skipped.  See rfc 1521, 2183, ...
3136    If no boundary is given, then entire message is skipped.
3137    
3138    This starts one line ABOVE the MIME content messages, on the boundary marker,
3139    for operation with the generic region-skipping code.
3140    This places new MIME boundaries into variable `ispell-checking-message'."
3141      (forward-line)                        ; skip over boundary to headers
3142      (let ((save-case-fold-search case-fold-search)
3143            (continuep t)
3144            textp)
3145        (setq case-fold-search t
3146              ispell-skip-html nil)
3147        (while continuep
3148          (setq continuep nil)
3149          (if (looking-at "Content-Type: *text/")
3150              (progn
3151                (goto-char (match-end 0))
3152                (if (looking-at "html")
3153                    (setq ispell-skip-html t))
3154                (setq textp t
3155                      continuep t)
3156                (re-search-forward "\\(.*;[ \t]*[\n]\\)*.*$" nil t)
3157                (forward-line)))
3158          (if (looking-at "Content-Transfer-Encoding: *\\([^ \t\n]*\\)")
3159              (let ((match (buffer-substring (match-beginning 1) (match-end 1))))
3160                (setq textp (member (upcase match)
3161                                    ;; only spell check the following encodings:
3162                                    '("7BIT" "8BIT" "QUOTED-PRINTABLE" "BINARY"))
3163                      continuep t)
3164                (goto-char (match-end 0))
3165                (re-search-forward "\\(.*;[ \t]*[\n]\\)*.*$" nil t)
3166                (forward-line)))
3167          ;; hierarchical boundary definition
3168          (if (looking-at "Content-Type: *multipart/")
3169              (let ((new-boundary (ispell-mime-multipartp)))
3170                (if (string-match new-boundary boundary)
3171                    (setq continuep t)
3172                  ;; first pass redefine skip function to include new boundary
3173                  ;;(re-search-backward boundary nil t)
3174                  (forward-line)
3175                  (setq ispell-checking-message
3176                        (cons
3177                         (list new-boundary 'ispell-mime-skip-part new-boundary)
3178                         (if (eq t ispell-checking-message) nil
3179                           ispell-checking-message))
3180                        textp t
3181                        continuep t)))
3182            ;; Skip all MIME headers that don't affect spelling
3183            (if (looking-at "Content-[^ \t]*: *\\(.*;[ \t]*[\n]\\)*.*$")
3184                (progn
3185                  (setq continuep t)
3186                  (goto-char (match-end 0))
3187                  (forward-line)))))
3188    
3189        (setq case-fold-search save-case-fold-search)
3190        (if textp
3191            (point)
3192          ;; encoded message.  Skip to boundary, or entire message.
3193          (if (not boundary)
3194              (goto-char (point-max))
3195            (re-search-forward boundary nil t)
3196            (beginning-of-line)
3197            (point)))))
3198    
3199    
3200  ;;;###autoload  ;;;###autoload
3201  (defun ispell-message ()  (defun ispell-message ()
# Line 2943  You can bind this to the key C-c i in GN Line 3220  You can bind this to the key C-c i in GN
3220    (interactive)    (interactive)
3221    (save-excursion    (save-excursion
3222      (goto-char (point-min))      (goto-char (point-min))
3223      (let* (      (let* (boundary mimep
3224               (ispell-skip-region-alist-save ispell-skip-region-alist)
3225             ;; Nil when message came from outside (eg calling emacs as editor)             ;; Nil when message came from outside (eg calling emacs as editor)
3226             ;; Non-nil marker of end of headers.             ;; Non-nil marker of end of headers.
3227             (internal-messagep             (internal-messagep
# Line 3013  You can bind this to the key C-c i in GN Line 3291  You can bind this to the key C-c i in GN
3291            (progn            (progn
3292              ;; Spell check any original Subject:              ;; Spell check any original Subject:
3293              (goto-char (point-min))              (goto-char (point-min))
3294              (setq case-fold-search t)              (setq case-fold-search t
3295                      mimep (re-search-forward "MIME-Version:" end-of-headers t))
3296                (goto-char (point-min))
3297              (if (re-search-forward "^Subject: *" end-of-headers t)              (if (re-search-forward "^Subject: *" end-of-headers t)
3298                  (progn                  (progn
3299                    (goto-char (match-end 0))                    (goto-char (match-end 0))
# Line 3027  You can bind this to the key C-c i in GN Line 3307  You can bind this to the key C-c i in GN
3307                                           (while (looking-at "\n[ \t]")                                           (while (looking-at "\n[ \t]")
3308                                             (end-of-line 2))                                             (end-of-line 2))
3309                                           (point)))))))                                           (point)))))))
3310              (setq case-fold-search old-case-fold-search)              (if mimep
3311              (goto-char end-of-headers)                  (progn
3312                      (goto-char (point-min))
3313                      (setq boundary (ispell-mime-multipartp end-of-headers))))
3314                ;; Adjust message limit to MIME message if necessary.
3315                (and boundary
3316                     (re-search-forward (concat boundary "--") nil t)
3317                     (re-search-backward boundary nil t)
3318                     (< (point) (marker-position limit))
3319                     (set-marker limit (point)))
3320                (goto-char (point-min))
3321                ;; Select type or skip checking if this is a non-multipart message
3322                ;; Point moved to end of buffer if region is encoded.
3323                (if (and mimep (not boundary))
3324                    (let (skip-regexp)      ; protect from `ispell-mime-skip-part'
3325                      (goto-char (point-min))
3326                      (re-search-forward "Content-[^ \t]*:" end-of-headers t)
3327                      (forward-line -1)     ; following fn starts one line above
3328                      (ispell-mime-skip-part nil)))
3329                (goto-char (max end-of-headers (point)))
3330              (forward-line 1)              (forward-line 1)
3331                (setq case-fold-search old-case-fold-search)
3332                ;; Define MIME regions to skip.
3333                (if boundary
3334                    (setq ispell-checking-message
3335                          (list (list boundary 'ispell-mime-skip-part boundary))))
3336              (ispell-region (point) limit))              (ispell-region (point) limit))
3337          (set-marker end-of-headers nil)          (set-marker end-of-headers nil)
3338          (set-marker limit nil)))))          (set-marker limit nil)
3339            (setq ispell-skip-region-alist ispell-skip-region-alist-save
3340                  ispell-skip-html nil
3341                  case-fold-search old-case-fold-search)))))
3342    
3343    
3344  (defun ispell-non-empty-string (string)  (defun ispell-non-empty-string (string)
# Line 3073  Includes Latex/Nroff modes and extended Line 3379  Includes Latex/Nroff modes and extended
3379      (ispell-send-string "-\n"))         ; set mode to normal (nroff)      (ispell-send-string "-\n"))         ; set mode to normal (nroff)
3380    ;; If needed, test for SGML & HTML modes and set a buffer local nil/t value.    ;; If needed, test for SGML & HTML modes and set a buffer local nil/t value.
3381    (if (and ispell-skip-html (not (eq ispell-skip-html t)))    (if (and ispell-skip-html (not (eq ispell-skip-html t)))
3382        (set (make-local-variable 'ispell-skip-html)        (setq ispell-skip-html
3383             (not (null (string-match "sgml\\|html"              (not (null (string-match "sgml\\|html"
3384                                      (downcase (symbol-name major-mode)))))))                                       (downcase (symbol-name major-mode)))))))
3385    ;; Set default extended character mode for given buffer, if any.    ;; Set default extended character mode for given buffer, if any.
3386    (let ((extended-char-mode (ispell-get-extended-character-mode)))    (let ((extended-char-mode (ispell-get-extended-character-mode)))
3387      (if extended-char-mode      (if extended-char-mode
# Line 3242  Both should not be used to define a buff Line 3548  Both should not be used to define a buff
3548  ; LocalWords:  Francais Nederlands charset autoloaded popup nonmenu regexp num  ; LocalWords:  Francais Nederlands charset autoloaded popup nonmenu regexp num
3549  ; LocalWords:  AMStex hspace includeonly nocite epsfig displaymath eqnarray reg  ; LocalWords:  AMStex hspace includeonly nocite epsfig displaymath eqnarray reg
3550  ; LocalWords:  minipage modeline pers dict unhighlight buf grep sync prev inc  ; LocalWords:  minipage modeline pers dict unhighlight buf grep sync prev inc
3551  ; LocalWords:  fn hilight oldot NB AIX msg init read's bufs pt cmd Quinlan eg  ; LocalWords:  fn hilight oldot NB AIX msg init read's bufs pt cmd eg multibyte
3552  ; LocalWords:  uuencoded unidiff sc nn VM SGML eval IspellPersDict unsplitable  ; LocalWords:  uuencoded unidiff sc nn VM SGML eval IspellPersDict unsplitable
3553  ; LocalWords:  lns XEmacs HTML casechars Multibyte  ; LocalWords:  lns XEmacs html casechars Multibyte Aug unix wp iso multiline
3554    ; LocalWords:  multipart aspell Fcc regexps tib russian latin Slovakian
3555    
3556  ;;; ispell.el ends here  ;;; ispell.el ends here

Legend:
Removed from v.1.137.4.2  
changed lines
  Added in v.1.137.4.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26