From: Eli Zaretskii Date: Sat, 3 Mar 2018 10:47:47 +0000 (+0200) Subject: Prevent Flyspell from changing unrelated words X-Git-Tag: emacs-26.1-rc1~129 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b80e15b6a6;p=emacs.git Prevent Flyspell from changing unrelated words * lisp/textmodes/flyspell.el (flyspell-auto-correct-word): Avoid using stale cached data from previous invocations of this command. (Bug#30462) --- diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index d87cb5e72ed..e4626696262 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -1944,6 +1944,10 @@ spell-check." (call-interactively flyspell--prev-meta-tab-binding) (let ((pos (point)) (old-max (point-max))) + ;; Flush a possibly stale cache from previous invocations of + ;; flyspell-auto-correct-word. + (if (not (eq last-command 'flyspell-auto-correct-word)) + (setq flyspell-auto-correct-region nil)) ;; Use the correct dictionary. (flyspell-accept-buffer-local-defs) (if (and (eq flyspell-auto-correct-pos pos)