From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Slawomir Nowaczyk Newsgroups: gmane.emacs.devel Subject: Re: flyspell bug Date: Mon, 07 Nov 2005 16:51:22 +0100 Message-ID: <20051107165012.074E.SLAWOMIR.NOWACZYK.847@student.lu.se> References: <20051031164057.1F82.SLAWOMIR.NOWACZYK.847@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1131378953 5786 80.91.229.2 (7 Nov 2005 15:55:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 7 Nov 2005 15:55:53 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 07 16:55:41 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EZ9Hn-00012I-Cw for ged-emacs-devel@m.gmane.org; Mon, 07 Nov 2005 16:51:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EZ9Hm-00078A-FY for ged-emacs-devel@m.gmane.org; Mon, 07 Nov 2005 10:51:54 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EZ9Hb-00077t-Hc for emacs-devel@gnu.org; Mon, 07 Nov 2005 10:51:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EZ9HZ-00077h-Qc for emacs-devel@gnu.org; Mon, 07 Nov 2005 10:51:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EZ9HY-00077e-7o for emacs-devel@gnu.org; Mon, 07 Nov 2005 10:51:41 -0500 Original-Received: from [130.235.16.11] (helo=himmelsborg.cs.lth.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EZ9HY-000804-7S for emacs-devel@gnu.org; Mon, 07 Nov 2005 10:51:40 -0500 Original-Received: from [127.0.0.1] (slawek@dain [130.235.16.76]) by himmelsborg.cs.lth.se (8.12.11/8.12.11/perf-jw-tr) with ESMTP id jA7FpWZ6013936 for ; Mon, 7 Nov 2005 16:51:32 +0100 (CET) Original-To: emacs-devel@gnu.org In-Reply-To: <20051031164057.1F82.SLAWOMIR.NOWACZYK.847@student.lu.se> X-Esmandil_Citation: done X-Mailer-Plugin: Popup Memopad for Becky!2 Ver.0.02 Rev.2 X-Mailer: Becky! ver. 2.21.04 [en] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:45552 Archived-At: OK, I finally had some time (not enough, though) to debug the problem, and here is what I have found. First of all, there is problem with flyspell-buffer not taking into account the LocalWords: definition (the list of words assumed to be correct in particular buffer). Words from this list are reported in flyspell-external-ispell-buffer by ispell, but are not considered to be misspelled by flyspell-word. This causes the logic in flyspell-external-point-words to get out of sync with the buffer contents. I do not know how to fix this, though. There is ispell-buffer-local-words in ispell.el, but I do not know enough about ispell to understand what it is doing, or even if this is a right place to start. As an ugly kludge, the following patch does seem to fix things for me: *** M:\EmacsCVS\EmacsCVS\lisp\textmodes\flyspell.el Mon Nov 7 15:00:13 2005 --- c:\Emacs\lisp\textmodes\flyspell.el Mon Nov 7 16:39:45 2005 *************** *** 1365,1371 **** (if (< (length (car (flyspell-get-word nil))) (length word)) nil ! (flyspell-word)))) (error "Bug: misspelled word `%s' (output pos %d) not found in buffer" word wordpos))))))) ;; we are done --- 1365,1374 ---- (if (< (length (car (flyspell-get-word nil))) (length word)) nil ! (if (= (length (car (flyspell-get-word nil))) ! (length word)) ! (and (flyspell-word) nil) ;; flyspell-word but exit the loop unconditionally ! (flyspell-word))))) (error "Bug: misspelled word `%s' (output pos %d) not found in buffer" word wordpos))))))) ;; we are done *************** But I would prefer to have LocalWords taken care of by ispell -- if only due to the fact that it should make flyspell-buffer significantly faster. Besides that, I believe the logic in flyspell-external-point-words should be simplified significantly -- we should get rid of the "while keep" loop, just find the first place where (if (= (length (flyspell-get-word nil)) (length word)) and flyspell-word that. And consider cases where ispell and flyspell have different ideas about word boundaries to be bugs and fix those. -- Best wishes, Slawomir Nowaczyk ( slawomir.nowaczyk.847@student.lu.se ) A computer DOES save time at work. I can play solitaire without having to spend all that time shuffling real cards.