From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Piet van Oostrum Newsgroups: gmane.emacs.devel Subject: Re: flyspell bug Date: Mon, 24 Oct 2005 15:39:43 +0200 Message-ID: References: <20051013122745.23F5.SLAWOMIR.NOWACZYK.847@student.lu.se> <20051014131718.2403.SLAWOMIR.NOWACZYK.847@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1130162126 20773 80.91.229.2 (24 Oct 2005 13:55:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Oct 2005 13:55:26 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 24 15:55:24 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EU2l6-0003VW-N7 for ged-emacs-devel@m.gmane.org; Mon, 24 Oct 2005 15:53:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EU2l6-00053B-7W for ged-emacs-devel@m.gmane.org; Mon, 24 Oct 2005 09:53:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EU2YJ-0006Ed-Cm for emacs-devel@gnu.org; Mon, 24 Oct 2005 09:39:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EU2YH-0006Cr-Ac for emacs-devel@gnu.org; Mon, 24 Oct 2005 09:39:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EU2YH-0006Ch-66 for emacs-devel@gnu.org; Mon, 24 Oct 2005 09:39:49 -0400 Original-Received: from [131.211.80.10] (helo=mail.cs.uu.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EU2YH-0007bE-4a for emacs-devel@gnu.org; Mon, 24 Oct 2005 09:39:49 -0400 Original-Received: from mail.cs.uu.nl (localhost.localdomain [127.0.0.1]) by mail.cs.uu.nl (Postfix) with ESMTP id 3F646A35E4 for ; Mon, 24 Oct 2005 15:39:48 +0200 (CEST) Original-Received: from ordesa.cs.uu.nl (ordesa.cs.uu.nl [131.211.81.146]) by mail.cs.uu.nl (Postfix) with ESMTP id 2893FA35DB for ; Mon, 24 Oct 2005 15:39:48 +0200 (CEST) Original-Received: by ordesa.cs.uu.nl (Postfix, from userid -2) id 7975224B73D; Mon, 24 Oct 2005 15:39:46 +0200 (CEST) Original-Received: from ordesa.cs.uu.nl (localhost [127.0.0.1]) by ordesa.cs.uu.nl (Postfix) with ESMTP id 0D88024B727 for ; Mon, 24 Oct 2005 15:39:45 +0200 (CEST) X-Mailer: emacs 22.0.50.3 (via feedmail 8 I) Original-To: emacs-devel@gnu.org In-Reply-To: (Piet van Oostrum's message of "Mon, 24 Oct 2005 09:16:39 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) X-AV-Checked: ClamAV using ClamSMTP at cs.uu.nl 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:44715 Archived-At: I have found the bug. Explanation: flyspell-buffer (actually flyspell-region) works in two different ways, depending on a small or large region to be checked. For a small region each word is subjected to flyspell-word. No problem. For a large region (default > 1000 characters) first the region is piped through ispell which returns a list of misspelled words. Then each of these words is searched for in the region (sequentially) and then flyspell-word is applied to it. This searching and spelling is done in a loop until the misspelling is found. In a TeX file, ispell should be called with the "-t" option and this is not done. That is the bug. What happens is that ispell finds a misspelled word, in the refcard.tex for example "newcount". The searching loop finds "newcount", applies flyspell-word, but flyspell-word accepts the word because it is in a TeX command. Therefore the loop continues until a really misspelled "newcount" is found. In this case there is none, so the loop stops after the second "\newcount". This looping is necessary, because (1) there could really be a word "newcount" without the backslash, (2) the word could be found as a substring of a correctly spelled word (e.g. when "redist" would appear after "redistribute"). The solution is to give ispell the "-t" option. diff -u ~/Projects/cvs/emacs/lisp/textmodes/flyspell.el flyspell.el --- /Users/piet/Projects/cvs/emacs/lisp/textmodes/flyspell.el 2005-10-24 09:17:22.000000000 +0200 +++ flyspell.el 2005-10-24 15:38:27.000000000 +0200 @@ -1389,6 +1389,8 @@ (if ispell-local-dictionary (setq ispell-dictionary ispell-local-dictionary)) (setq args (ispell-get-ispell-args)) + (if (eq ispell-parser 'tex) + (setq args (cons "-t" args))) (if ispell-dictionary ; use specified dictionary (setq args (append (list "-d" ispell-dictionary) args))) -- Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: piet@vanoostrum.org