Subject: Re: bug#29321: Isearch hit count

From: Juri Linkov <[email-masked]>
Date: Mon, 05 Nov 2018 00:50:33 +0200

> I was thinking about this request, and thinking along these
> lines: Where we count, push (match # . buffer-position)
> to an alist variable.  The variable would get reinitialized
> when counting gets reinitialized (e.g. for a new search
> string, direction change, or startup of Isearch).
>
> That alist could be used to go to any given match, either
> during the current Isearch or later.  If they wanted, users
> could even save copies of the alist for different searches,
> for subsequent reuse.

A mapping from search parameters (search string, direction, etc.)
to the matches and buffer-positions invalidates too quickly.
Even using point-markers doesn't help when a user deletes
a large region with former matches.

> I was thinking of binding a key during Isearch to move to
> an occurrence by its match number.  `M-g' perhaps.  With
> a numeric prefix arg it would move to that number.  With
> no prefix arg it would prompt for the number (with
> completion requiring a match against the alist).

I understand that in addition to relative counting like
'C-u 42 C-s' would do, you propose absolute counting like
'C-s M-g 42 RET'.  But a question: shouldn't 'M-g'
exit the search since it's a global prefix key.