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

From: Juri Linkov <[email-masked]>
Date: Sun, 06 Dec 2015 01:04:15 +0200

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

This is a nice ASCII-art in itself :-), but the problem is in another place -
in ispell-highlight-spelling-error-overlay you can see word boundaries
"\\b" that were added for every search string to not highlight parts
of words, such as when the current check is for e.g. "init", we don't
want to highlight "init" in the words "initialize", "initially", etc.
The drawback of this approach is that it depends on the word syntax in a
particular mode.

Another limitation is limiting lazy-highlighting by reg-start/reg-end
instead of a wider area of window-start/window-end.

Finally, we need now here this fix:

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index fe27f0f..aa51446 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2809,6 +2809,7 @@ ispell-highlight-spelling-error-overlay
 		  (regexp-quote (buffer-substring-no-properties start end))
 		  "\\b"))
 		(isearch-regexp t)
+		(isearch-regexp-function nil)
 		(isearch-case-fold-search nil)
 		(isearch-forward t)
 		(isearch-other-end start)