Subject: Re: bug#21092: 25.0.50; Option `lazy-highlight-max-at-a-time' does not work

From: Juri Linkov <[email-masked]>
Date: Thu, 24 Dec 2015 02:47:15 +0200

> the new ‘lazy-highlight-buffer’ to toggle between whole-buffer and
> screen-only implemented by this small patch:

Commenting out window-local lazy-highlighting overlay in bug#17453

 			  ;; 1000 is higher than ediff's 100+,
 			  ;; but lower than isearch main overlay's 1001
 			  (overlay-put ov 'priority 1000)
-			  (overlay-put ov 'face lazy-highlight-face)
-			  (overlay-put ov 'window (selected-window))))
+			  (overlay-put ov 'face lazy-highlight-face)))
+			  ;(overlay-put ov 'window (selected-window))))

produces such deficiency that when two windows are displaying different parts
of the same buffer (without using follow-mode), sometimes lazy-highlighted
matches are partially (i.e. not all matches) displayed in non-current
window when lazy-highlighting boundary of the selected window is in the
middle of other window.  This causes false impression that other window is
responsible to highlight all visible matches but fails to do so.

A solution is to install the 3rd patch posted by Artur in
http://debbugs.gnu.org/17453#89 that adds a new option ‘all-windows’ to
‘isearch-lazy-highlight’.  Then we could setq-local it to ‘all-windows’
in ‘follow-mode’, and don't highlight matches in other windows by default
(keeping its old behavior).

The same solution could be applied to bug#21092, to add a new option
‘buffer’ to ‘isearch-lazy-highlight’ to lazy-highlight the whole buffer.
Then ‘follow-mode’ should check it, and override it with buffer-local
‘all-windows’ only when it was ‘t’ initially.