Use local var buffer-scan-pos to advance scan for next misspelling.
Advance it only after we find the misspelling.
New criteria for finding the misspelling in the buffer.
search if: (a) misspelling and found string lengths match, or (b) misspelling
is found as element in a boundary-chars separated longer string, or
(c) ispell-program-name is really ispell and misspelling is found as part of
a TeX string. After successful match move beginning of search region to end
of match. Warn about not found misspellings once the process is done.
(flyspell-large-region) Do not set ispell-parser to tex if in TeX mode.
(flyspell-accept-buffer-local-defs): Use it to avoid silly redundant work.
(flyspell-mode-on): Use add-hook for after-change-functions.
(flyspell-mode-off): Use remove-hook for after-change-functions.
(flyspell-changes): Make it buffer-local.
(flyspell-after-change-function): Make it non-interactive. Use push.
(flyspell-post-command-hook): Check input-pending-p while processing
the potentially long list of buffer changes.
(flyspell-emacs): Remove unused var.
(flyspell-accept-buffer-local-defs): Use save-current-buffer.
(flyspell-debug-signal-no-check, flyspell-debug-signal-changed-checked)
(flyspell-debug-signal-pre-word-checked, flyspell-post-command-hook)
(flyspell-debug-signal-word-checked): Use with-current-buffer.
(make-flyspell-overlay): Don't locally reuse a global name.
(flyspell-highlight-incorrect-region)
(flyspell-highlight-duplicate-region): Use flyspell-unhighlight-at.
(flyspell-check-previous-highlighted-word): Use flyspell-overlay-p.
(flyspell-notify-misspell): Remove unused args `start' and `end'.
(flyspell-word): Adjust call accordingly. Use ispell-send-string.
Wrap calls to accept-process-output inside with-local-quit since it's
often called from a post-command-hook.
(flyspell-correct-word, flyspell-auto-correct-word): Use ispell-send-string.
(flyspell-xemacs-popup): Remove unused arg `event'. Update call.
(flyspell-notify-misspell): Fix misspelling of "Misspelling".
(flyspell-process-localwords): New function.
(flyspell-large-region): Call flyspell-process-localwords and
flyspell-delete-region-overlays.
(flyspell-delete-region-overlays): New function.
(flyspell-delete-all-overlays): Call that.
(flyspell-local-mouse-map): Declaration deleted.
(flyspell-mouse-map): Bind only mouse-2.
(flyspell-mode-map): Don't test flyspell-use-local-map.
(flyspell-overlay-keymap-property-name): Var deleted.
(flyspell-mode-on): Don't make local bindings for
flyspell-mouse-map and flyspell-mode-map.
(make-flyspell-overlay): Unconditionally put on `keymap' text prop.
(flyspell-duplicate-face): Use (X)Emacs-agnostic code.
(flyspell-mode-map): Don't overwrite at each load. Remove code
redundant with the subsequent add-minor-mode. Merge Emacs and XEmacs code.
(flyspell-word): Minor simplification.
(flyspell-math-tex-command-p): Quieten the byte-compiler.
(flyspell-external-point-words): Remove unused vars `size' and `start'.
(flyspell-do-correct): Rename from flyspell-xemacs-correct.
Merge the corresponding Emacs code.
(flyspell-correct-word, flyspell-xemacs-popup): Use flyspell-do-correct.