emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: flyspell bug


From: Piet van Oostrum
Subject: Re: flyspell bug
Date: Mon, 24 Oct 2005 15:39:43 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

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 <address@hidden>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]