GNU bug report logs - #6388
Should not match data be set on misses?

Previous Next

Package: emacs;

Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>

Date: Thu, 10 Jun 2010 00:50:03 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#6388: closed (Should not match data be set on misses?)
Date: Thu, 10 Jun 2010 02:04:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 09 Jun 2010 22:03:08 -0400
with message-id <E1OMX6q-0004aE-VV <at> fencepost.gnu.org>
and subject line Re: bug#6388: Should not match data be set on misses?
has caused the GNU bug report #6388,
regarding Should not match data be set on misses?
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
6388: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6388
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Emacs Bugs <bug-gnu-emacs <at> gnu.org>
Subject: Should not match data be set on misses?
Date: Thu, 10 Jun 2010 02:42:59 +0200
(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


[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 6388-done <at> debbugs.gnu.org
Subject: Re: bug#6388: Should not match data be set on misses?
Date: Wed, 09 Jun 2010 22:03:08 -0400
> From: Lennart Borgman <lennart.borgman <at> gmail.com>
> 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).


This bug report was last modified 14 years and 350 days ago.

Previous Next


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