On Wed, Nov 16, 2005 at 03:22:42PM +0000, Agustin Martin wrote: > Slawomir Nowaczyk student.lu.se> writes: > > > > 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. > > I think you need the (while keep) loop for this. > > > And consider cases where ispell and flyspell > > have different ideas about word boundaries to be bugs and fix those. > > Some of these might require a not found word be signalled by something softer > than an error. > > I am also taking a look at this function making keep nil if any of some > conditions is matched. Will send something as soon as looks better (if so), > even if still full of debugging code I am attaching the function as currently looks in my system. It is still plenty of debugging code and could surely be simplified, but seems to work reasonably. However much more test is needed. The basic check is the one you proposed, check lengths (seems to suffice, but this might be raised to a 'string=' comparison if needed), but some other checks are added, mostly for ispell benefit: (member word (split-string flyword-prev ispell-otherchars)) will try to see if word has been found as part of a boundary-chars separated compound word. If so, skip word and move point to the match point, not to the end of the flyspell-get-word word found, just in case next element in that compound word is also misspelled (we would lose it otherwise and might unsync the process). (and (not ispell-really-aspell) (save-excursion (goto-char (- (nth 1 flyword-prev-l) 1)) (if (looking-at "[\\]" ) (progn (when mydebug (message "[%s] %s has nroff problems in \\%s" (match-string 0) word flyword-prev)) t) nil )) ispell (not aspell) works in nroff mode as default, for that reason if a tex string is in a non tex file, it might get stripped of the first chars, because they can match a nroff command, \special -> ecial thus making the mispelled word 'ecial' not be found in buffer, or unsync the process if 'ecial' would be a good word present later. If any of these tests matches, word is considered as found and (flyspell-word) is run on it. I still find some problems in tex mode with the '-t' option introduced in flyspell-large-region, but this might be independent of this change. I still have to look better at this. -- Agustin