From b80e15b6a6d06fc2937a9c11c1cae5619ceed9c3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 3 Mar 2018 12:47:47 +0200 Subject: [PATCH] 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) --- lisp/textmodes/flyspell.el | 4 ++++ 1 file changed, 4 insertions(+) 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) -- 2.39.5