From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#30462: flyspell-auto-correct-word 'corrects' more than the current word Date: Sat, 17 Feb 2018 18:09:37 +0200 Message-ID: <83sh9zbnsu.fsf@gnu.org> References: <87h8qi93dy.fsf@jidanni.org> <87y3juo1hq.fsf_-_@jidanni.org> <838tbuw5st.fsf@gnu.org> <6d3dc737-73ae-e6c6-5058-85d73421f9e9@yandex.ru> <838tbtdx0p.fsf@gnu.org> <9cee145f-0663-3043-b9b0-5133da1f0b00@yandex.ru> <83606xdp1m.fsf@gnu.org> <834lmhdnl8.fsf@gnu.org> <833721dmwu.fsf@gnu.org> <87o9koo2i6.fsf@jidanni.org> <83eflkcb14.fsf@gnu.org> <87lgfr7ipk.fsf@jidanni.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1518883712 19929 195.159.176.226 (17 Feb 2018 16:08:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 17 Feb 2018 16:08:32 +0000 (UTC) Cc: 30462@debbugs.gnu.org, dgutov@yandex.ru To: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 17 17:08:27 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en51z-0003aw-R9 for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Feb 2018 17:08:07 +0100 Original-Received: from localhost ([::1]:36583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en540-0002V9-Do for geb-bug-gnu-emacs@m.gmane.org; Sat, 17 Feb 2018 11:10:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en53u-0002Ul-7s for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2018 11:10:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en53q-00036U-0z for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2018 11:10:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40582) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1en53p-00036L-TC for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2018 11:10:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1en53p-0007dn-Nx for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2018 11:10:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Feb 2018 16:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30462 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30462-submit@debbugs.gnu.org id=B30462.151888379129343 (code B ref 30462); Sat, 17 Feb 2018 16:10:01 +0000 Original-Received: (at 30462) by debbugs.gnu.org; 17 Feb 2018 16:09:51 +0000 Original-Received: from localhost ([127.0.0.1]:48479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en53e-0007dD-UX for submit@debbugs.gnu.org; Sat, 17 Feb 2018 11:09:51 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en53d-0007d0-1T for 30462@debbugs.gnu.org; Sat, 17 Feb 2018 11:09:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en53X-0002iI-1h for 30462@debbugs.gnu.org; Sat, 17 Feb 2018 11:09:43 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en53P-0002Xz-AI; Sat, 17 Feb 2018 11:09:35 -0500 Original-Received: from [176.228.60.248] (port=4081 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1en53O-00018U-Pf; Sat, 17 Feb 2018 11:09:35 -0500 In-reply-to: <87lgfr7ipk.fsf@jidanni.org> (message from =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson on Sat, 17 Feb 2018 23:13:11 +0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:143387 Archived-At: > From: 積丹尼 Dan Jacobson > 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)