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: Drew Adams
Subject: bug#29321: Isearch hit count
Date: Tue, 30 Oct 2018 16:35:42 -0700 (PDT)

> > 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"?

I didn't notice it, but sure, I understand that matching
backward is not the same as forward.

Dunno why that would produce the symptoms I described,
however.

> 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.

That all makes sense.

But I don't think that explains the part of the
behavior where the prompt does not appear without
changing direction, just by repeating search (e.g.
always forward) very quickly.  Or if it does explain
it somehow, I don't quite get it yet.

> 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.

I'll give it a try.

Thx - Drew





reply via email to

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