GNU bug report logs - #24801
25.1; Reverse regexp search highlighting

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Wed, 26 Oct 2016 16:25:02 UTC

Severity: minor

Tags: notabug

Merged with 9681, 11025

Found in versions 23.1, 25.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #8 received at 24801 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 24801 <at> debbugs.gnu.org
Subject: Re: bug#24801: 25.1; Reverse regexp search highlighting
Date: Wed, 26 Oct 2016 18:42:20 -0400
Drew Adams <drew.adams <at> oracle.com> 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.




This bug report was last modified 8 years and 208 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.