Subject: Re: bug#22097: Ispell: lazy highlighting doesn't work properly.

From: Alan Mackenzie <[email-masked]>
Date: Sat, 5 Dec 2015 16:04:29 +0000

Hello, Eli.

On Sat, Dec 05, 2015 at 04:20:38PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 5 Dec 2015 14:06:09 +0000
> > Cc: [email-masked]
> > From: Alan Mackenzie <[email-masked]>

[ .... ]

> > However, the bug manifests itself a bit later on in plain text.

> > There's a paragraph starting at L199 about bidi.  After several more
> > hits on the space bar, the first occurrence of "bidi" (L201) gets
> > highlighted; the second occurrence (on the same line) gets lazily
> > highlighted.  The third (L204) and fourth (L205) remain unhighlighted.

> > Hit the spacebar another time.  All four occurrences are now
> > highlighted.

> > As far as I can see, there's nothing remotely ASCII-arty in that
> > paragraph.  Unless the "---" sequences are somehow being interpreted as
> > ASCII-art.

> ispell-skip-region-alist is a complex regexp, something there must've
> (mis)fired.

I've got a little tool that dumps regexps in a more readable form.  Here
is what it makes of ispell-skip-region-alist:

\(   \|  \|                                                                         \)
  --+  _+  \(   \|                      \)\(  \|    \)*\(                        \)+
             /\w  \(                  \)    \w  [-_]     [.:/@]+\(  \|        \)+
                    \(  \|    \)+[.:@]                            \w  [-_~=?&]
                      \w  [-_]

Clearly, the "---"s are going to trigger the very first alternative of
the regexp.  I don't think "bidi.c", of itself, triggers the regexp.

The first two alternatives were added in "for performance reasons" for
when "-" or "_" are part of word syntax.  In otherwords, "\w\|[-_]" was
leading to exponential degradation in these circumstances.

However, nowadays we've got "\s_", which probably didn't exist when
ispell.el was written.  We could reformulate the regexp using it, which
might allow us to get rid of the "--+" and "_+" alternatives.

-- 
Alan Mackenzie (Nuremberg, Germany).