bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29321: Isearch hit count


From: Juri Linkov
Subject: bug#29321: Isearch hit count
Date: Wed, 31 Oct 2018 01:07:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

> I still do see the problem (did I mention this one?)
> that if I reverse direction so that the prompt changes
> to, say, Overwrapped..., there is no count shown.  But
> later sometimes it comes back.
>
> Does this make sense?  Why would the prompt sometimes
> disappear?  That must mean that, for some reason,
> `isearch-lazy-count-current' is nil, right?
>
> Do you see this?  It might help to repeat-search
> quickly; dunno.  I'm still searching just with the
> regexp "se\(.*\)r", FWIW.

Congratulations, you stumbled upon long-standing backward regexp
search controversy.

Reversing direction invalidates the number of matches
because it will find another number.  Did you notice
that the total number of matches is different after
switching direction e.g. for "se\(.*\)r"?

Here is a minimal test case:

0. emacs -Q

1. Paste this text to the end of *scratch*:

  Does this make sense?  Why would the prompt sometimes disappear?

2. For convenience, put this regexp to the regexp search history:
   C-M-s se\(.*\)r RET

3. Go to the beginning of *scratch*

4. Type C-M-s C-s

See the following text is matched and highlighted:

  sense?  Why would the prompt sometimes disappear?

5. Type C-r

See another part of this text is matched and highlighted:

  se?  Why would the prompt sometimes disappear?

6. Type C-s

See the second text is matched and highlighted:

  se?  Why would the prompt sometimes disappear?

not the initial text:

  sense?  Why would the prompt sometimes disappear?

This is why no count is shown.  Lazy-count searches
from the top of the buffer.  However, C-s C-r C-s
finds a shorter match after switching direction.

The problem occurs only with different values of
isearch-other-end that corresponds to match-beginning,
not with match-end that coincides with point.

Initially I planned to use point, not isearch-other-end.
But since there is no special isearch variable for point,
and the value of point is changed by the lazy updating,
I was too lazy to add a corresponding variable for point.

Now a new version attached below just let-binds the
initial value of point.  You can compare it with the
previous version to see the change.  The fix is very small.

Attachment: isearch.count.4.el
Description: application/emacs-lisp


reply via email to

[Prev in Thread] Current Thread [Next in Thread]