Subject: bug#29321: Isearch hit count

From: Drew Adams <[email-masked]>
Date: Sat, 27 Oct 2018 15:25:30 -0700 (PDT)

> > Isearch could show in the mode line how many matches follow or precede
> > the currently highlighted one (or we could write "3 of 4 matches", as,
> > e.g., Firefox does).  For big files, it could be helpful to calculate
> > this information either lazily or in another thread.

1. The doc for `isearch-lazy-count' says this:

    Counts matches in the full buffer.
    When non-nil, all matches in the full buffer are counted.

   The user-visible difference is the indication in the Isearch
   prompt of the current match number and the total number.

   The current doc makes it sounds like it maybe counts matches
   other than for the full buffer when nil, or that this depends
   in some way on `isearch-lazy-highlight-buffer'.  And it doesn't
   say what is done with the count.

   Suggested doc (or similar):

    Show match number in the Isearch prompt.
    Non-nil means show CURRENT/TOTAL, where CURRENT is the current match
    number and TOTAL is the number of matches in the buffer (or its
    restriction).

2. If I set `isearch-lazy-highlight' to nil after using search
   with it as t, the last lazy count indication remains present,
   even though the count does not get updated.

3. Since (presumably) this counting feature is available only
   when `isearch-lazy-highlight' is non-nil, which justifies the
   use of "lazy" in the option value, this fact should be mentioned
   in the doc.

   Suggested doc (or similar):

    Show match number in the Isearch prompt.
    When both this option and `isearch-lazy-highlight' are non-nil, show
    CURRENT/TOTAL, where CURRENT is the current match number and TOTAL is
    the total number of matches in the buffer (or its restriction).

4. Maybe the option should be called `isearch-show-match-number',
   but `isearch-lazy-count' sounds better, and it hints that it
   depends on `isearch-lazy-highlight'.