unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 30462@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#30462: flyspell-auto-correct-word 'corrects' more than the current word
Date: Sat, 17 Feb 2018 18:09:37 +0200	[thread overview]
Message-ID: <83sh9zbnsu.fsf@gnu.org> (raw)
In-Reply-To: <87lgfr7ipk.fsf@jidanni.org> (message from 積丹尼 Dan Jacobson on Sat, 17 Feb 2018 23:13:11 +0800)

> From: 積丹尼 Dan Jacobson <jidanni@jidanni.org>
> Cc: 30462@debbugs.gnu.org,  dgutov@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)





  reply	other threads:[~2018-02-17 16:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15  6:24 bug#30462: flyspell-auto-correct-word 'corrects' more than the current word 積丹尼 Dan Jacobson
2018-02-15 12:00 ` Eli Zaretskii
2018-02-15 12:56   ` 積丹尼 Dan Jacobson
2018-02-15 16:56     ` Eli Zaretskii
2018-02-16  0:22       ` 積丹尼 Dan Jacobson
2018-02-16 10:15       ` Dmitry Gutov
2018-02-16 10:55         ` Eli Zaretskii
2018-02-16 11:03           ` 積丹尼 Dan Jacobson
2018-02-16 11:36           ` Dmitry Gutov
2018-02-16 13:47             ` Eli Zaretskii
2018-02-16 14:18               ` Eli Zaretskii
2018-02-16 14:33                 ` Eli Zaretskii
2018-02-17  0:58                   ` 積丹尼 Dan Jacobson
2018-02-17  7:47                     ` Eli Zaretskii
2018-02-17 11:43                       ` 積丹尼 Dan Jacobson
2018-02-17 14:51                       ` 積丹尼 Dan Jacobson
2018-02-17 15:13                       ` 積丹尼 Dan Jacobson
2018-02-17 16:09                         ` Eli Zaretskii [this message]
2018-02-17 23:37                           ` 積丹尼 Dan Jacobson
2018-02-20  0:24                           ` Dmitry Gutov
2018-02-20  4:08                             ` Eli Zaretskii
2018-03-03 10:49                               ` Eli Zaretskii
2018-02-20  0:28                 ` Dmitry Gutov
2018-02-20  4:24                   ` Eli Zaretskii
2018-02-20 11:38                     ` Dmitry Gutov
2018-02-20 17:57                       ` 積丹尼 Dan Jacobson
2018-02-20  0:51               ` Dmitry Gutov
2018-02-18  0:14   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83sh9zbnsu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=30462@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=jidanni@jidanni.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).