summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2018-03-03 12:47:47 +0200
committerEli Zaretskii <eliz@gnu.org>2018-03-03 12:47:47 +0200
commitb80e15b6a6d06fc2937a9c11c1cae5619ceed9c3 (patch)
treeb341286beef76d92d8b0b7414b07c74e4b1e5a98
parente385599457497d0ad1a103363eec73e09058c24a (diff)
downloademacs-b80e15b6a6d06fc2937a9c11c1cae5619ceed9c3.tar.gz
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)
-rw-r--r--lisp/textmodes/flyspell.el4
1 files changed, 4 insertions, 0 deletions
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)