]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent Flyspell from changing unrelated words
authorEli Zaretskii <eliz@gnu.org>
Sat, 3 Mar 2018 10:47:47 +0000 (12:47 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 3 Mar 2018 10:47:47 +0000 (12:47 +0200)
* 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

index d87cb5e72ed467040beef3b07e696baffe12623e..e46266962625ad4ad73d98ad6122265a8947eded 100644 (file)
@@ -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)