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

From: Drew Adams <[email-masked]>
Date: Fri, 28 Aug 2015 14:43:11 -0700 (PDT)

> Eli is right - lazy-highlight is designed to show matches
> only on the screen.

No, that is wrong.  And that is not what Eli said, in any case.
He said that the display engine (not lazy-highlight) is designed to
highlight only what is shown on the screen.

Lazy highlighting seems pretty clearly to have been designed from the
outset with the possibility that you can control how much it highlights,
for _performance_ reasons, and that you can, explicitly, choose to
highlight everywhere if you want.

By default, lazy highlighting does not extend far, and it is removed
when you finish searching.  But both of these default behaviors are
optional, changeable for situations where you want to highlight more
and you want to keep the highlighting after searching, respectively.
I think Eli was mistaken wrt each of these, but that's not important.
 
> A fix for the docstring of ‘lazy-highlight-max-at-a-time’ is to replace
>   “A value of nil means highlight all matches.” with
>   “A value of nil means highlight all matches shown on the screen.”

I disagree strongly that this is proper.  This is not a doc problem.
Clearly the intention of nil `lazy-highlight-max-at-a-time' is to
enable lazy highlighting throughout the search space.

> > And given that Lisp code apparently _can_ highlight a whole, large
> > buffer (AFAICT), if you have any tips on how I might make this work,
> > myself, for Isearch lazy highlighting, please pass them along.
> 
> To highlight the whole buffer you can use ‘C-s the M-s h r’
> (isearch-highlight-regexp).

My request was before I found a fix, and it was to help find a fix
for the bug, not to highlight a regexp everywhere.

What you mention here is totally unrelated to lazy highlighting, not
only in effect but in purpose.  I did not ask how to highlight a
regexp throughout a buffer.  I asked for tips about fixing the bug,
so that lazy highlighting could optionally be applied throughout the
buffer, as intended by a nil value of ‘lazy-highlight-max-at-a-time’.

Please see the simple patch I sent, which I think takes care of this.