diff -r 0de00de3360c -r 06af33083844 site-lisp/flyspell.el --- a/site-lisp/flyspell.el Sat Nov 06 08:10:07 2010 -0400 +++ b/site-lisp/flyspell.el Sat Nov 06 08:23:58 2010 -0400 @@ -1009,7 +1009,7 @@ ;;*---------------------------------------------------------------------*/ ;;* flyspell-word ... */ ;;*---------------------------------------------------------------------*/ -(defun flyspell-word (&optional following) +(defun flyspell-word (&optional following known-misspelling) "Spell check a word." (interactive (list ispell-following-word)) (ispell-set-spellchecker-params) ; Initialize variables and dicts alists @@ -1071,29 +1071,35 @@ (setq flyspell-word-cache-end end) (setq flyspell-word-cache-word word) ;; now check spelling of word. - (ispell-send-string "%\n") - ;; put in verbose mode - (ispell-send-string (concat "^" word "\n")) - ;; we mark the ispell process so it can be killed - ;; when emacs is exited without query - (set-process-query-on-exit-flag ispell-process nil) - ;; Wait until ispell has processed word. Since this code is often - ;; executed from post-command-hook but the ispell process may not - ;; be responsive, it's important to make sure we re-enable C-g. - (with-local-quit - (while (progn - (accept-process-output ispell-process) - (not (string= "" (car ispell-filter)))))) - ;; (ispell-send-string "!\n") - ;; back to terse mode. - ;; Remove leading empty element - (setq ispell-filter (cdr ispell-filter)) - ;; ispell process should return something after word is sent. - ;; Tag word as valid (i.e., skip) otherwise - (or ispell-filter - (setq ispell-filter '(*))) - (if (consp ispell-filter) - (setq poss (ispell-parse-output (car ispell-filter)))) + (if (not known-misspelling) + (progn + (ispell-send-string "%\n") + ;; put in verbose mode + (ispell-send-string (concat "^" word "\n")) + ;; we mark the ispell process so it can be killed + ;; when emacs is exited without query + (set-process-query-on-exit-flag ispell-process nil) + ;; Wait until ispell has processed word. Since this + ;; code is often executed from post-command-hook but + ;; the ispell process may not be responsive, it's + ;; important to make sure we re-enable C-g. + (with-local-quit + (while (progn + (accept-process-output ispell-process) + (not (string= "" (car ispell-filter)))))) + ;; (ispell-send-string "!\n") + ;; back to terse mode. + ;; Remove leading empty element + (setq ispell-filter (cdr ispell-filter)) + ;; ispell process should return something after word is sent. + ;; Tag word as valid (i.e., skip) otherwise + (or ispell-filter + (setq ispell-filter '(*))) + (if (consp ispell-filter) + (setq poss (ispell-parse-output (car ispell-filter))))) + ;; Else, this was a known misspelling to begin with, and + ;; we should forge an ispell return value. + (setq poss (list word 0 '() '()))) (let ((res (cond ((eq poss t) ;; correct (setq flyspell-word-cache-result t) @@ -1424,7 +1430,7 @@ t nil)))) (setq keep nil) - (flyspell-word) + (flyspell-word nil t) ;; Search for next misspelled word will begin from ;; end of last validated match. (setq buffer-scan-pos (point))))