GNU bug report logs - #30462
flyspell-auto-correct-word 'corrects' more than the current word

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Thu, 15 Feb 2018 07:40:02 UTC

Severity: minor

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 30462 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: bug#30462: flyspell-auto-correct-word 'corrects' more than the current word
Date: Sat, 17 Feb 2018 18:09:37 +0200
> From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
> Cc: 30462 <at> debbugs.gnu.org,  dgutov <at> yandex.ru
> Date: Sat, 17 Feb 2018 23:13:11 +0800
> 
> after the "thier t".
> Now hit some ESC TABs.
> Notice how way off the screen near the top, "theww" is mutating further and further.

But if you kill the buffer, then create a new one, insert the same
text into it, activate flyspell-mode, and try ESC TAB at the same
place, you won't see the problem, right?

I think I see the reason for this: it's a stale cache from a previous
invocation of flyspell-auto-correct-word that is not flushed when you
type more text or move point.  So flyspell-auto-correct-word tries to
correct the same word het time you invoke it, no matter how far away
are you.

Please try the patch below (you will need to byte-compile flyspell.el
after applying the patch).  If it gives good results, please run with
it for a while and see if there are any problems left.  If this change
has no adverse effects, I will push it.

diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 5568bbb..2187766 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1933,6 +1933,8 @@ flyspell-auto-correct-word
       (call-interactively flyspell--prev-meta-tab-binding)
     (let ((pos     (point))
           (old-max (point-max)))
+      (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)




This bug report was last modified 7 years and 79 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.