Subject: bug#6388: closed (Re: bug#6388: Should not match data be set on misses?)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 10 Jun 2010 02:04:02 +0000

Your bug report

#6388: Should not match data be set on misses?

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
6388: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6388
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#6388: Should not match data be set on misses?
From: Eli Zaretskii <[email-masked]>
To: Lennart Borgman <[email-masked]>
Cc: [email-masked]
Date: Wed, 09 Jun 2010 22:03:08 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Lennart Borgman <[email-masked]>
> Date: Thu, 10 Jun 2010 02:42:59 +0200
> Cc: 
> 
> (let ((ret (re-search-forward "some weird thing" (point-at-eol) t)))
>   (message "ret=%s, mb0=%s, 1" ret (match-beginning 0) (match-beginning 1)))
> 
> gives me messages like
> 
>    ret=nil, mb0=517, 1
> 
> I expected
> 
>    ret=nil, mb0=nil, nil

I'm closing this bug report because the ELisp manual explicitly
documents the current behavior:

      Every successful search sets the match data.  Therefore, you should
   query the match data immediately after searching, before calling any
   other function that might perform another search.  Alternatively, you
   may save and restore the match data (*note Saving Match Data::) around
   the call to functions that could perform another search.

      A search which fails may or may not alter the match data.  In the
   past, a failing search did not do this, but we may change it in the
   future.  So don't try to rely on the value of the match data after a
   failing search.

Patches welcome to "change this in the future" (unless Stefan or
Yidong object to such a change).

Subject: Should not match data be set on misses?
From: Lennart Borgman <[email-masked]>
To: Emacs Bugs <[email-masked]>
Date: Thu, 10 Jun 2010 02:42:59 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

(let ((ret (re-search-forward "some weird thing" (point-at-eol) t)))
  (message "ret=%s, mb0=%s, 1" ret (match-beginning 0) (match-beginning 1)))

gives me messages like

   ret=nil, mb0=517, 1

I expected

   ret=nil, mb0=nil, nil