unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Drew Adams <drew.adams@oracle.com>
Cc: 24801@debbugs.gnu.org
Subject: bug#24801: 25.1; Reverse regexp search highlighting
Date: Wed, 26 Oct 2016 18:42:20 -0400	[thread overview]
Message-ID: <8737jispf7.fsf@users.sourceforge.net> (raw)
In-Reply-To: <4efa49bf-c223-4148-a291-12a722db033c@default> (Drew Adams's message of "Wed, 26 Oct 2016 09:24:02 -0700 (PDT)")

Drew Adams <drew.adams@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.





  reply	other threads:[~2016-10-26 22:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 16:24 bug#24801: 25.1; Reverse regexp search highlighting Drew Adams
2016-10-26 22:42 ` npostavs [this message]
2016-10-26 23:23   ` Drew Adams
2016-10-26 23:36     ` npostavs
2016-10-27  1:51       ` Drew Adams
2016-10-27  2:33   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737jispf7.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=24801@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).