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

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

bug#24801: 25.1; Reverse regexp search highlighting


From: npostavs
Subject: bug#24801: 25.1; Reverse regexp search highlighting
Date: Wed, 26 Oct 2016 18:42:20 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Drew Adams <address@hidden> writes:

> emacs -Q
>
> Visit the attached file in text mode.
>
> `C-M-s aa.*' and repeat.  highlighting seems fine, and search moves
> forward with one search hit per line, with that search hit including all
> of the consecutive a's in the line.
>
> `C-M-r' and repeat (same search pattern).  Search hits are just _pairs_
> of consecutive a's (so more than one hit per line), and lines that have
> an odd number of consecutive a's do not include the first a in a search
> hit.
>
> This seems wrong.  Am I missing something, or is this a bug?
>
> I see this behavior in Emacs 23 and later, but not in Emacs 22 and
> before, so I'm guessing this change is maybe intentional.  But it's not
> clear to me why it would be.

`(elisp) Regexp Search', under `re-search-backward' says:

     This function is analogous to `re-search-forward', but they are not
     simple mirror images.  `re-search-forward' finds the match whose
     beginning is as close as possible to the starting point.  If
     `re-search-backward' were a perfect mirror image, it would find the
     match whose end is as close as possible.  However, in fact it
     finds the match whose beginning is as close as possible (and yet
     ends before the starting point).  The reason for this is that
     matching a regular expression at a given spot always works from
     beginning to end, and starts at a specified beginning position.

     A true mirror-image of `re-search-forward' would require a special
     feature for matching regular expressions from end to beginning.
     It's not worth the trouble of implementing that.

And the texi source says the same at tag emacs-22.1; I've only built
Emacs back to 23.4 though, so I can't test it.





reply via email to

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