all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matthew Swift <swift@alum.mit.edu>
Subject: `match-data' set improperly
Date: Tue, 11 Feb 2003 22:16:57 -0500	[thread overview]
Message-ID: <200302120316.h1C3Gvcu007789@beth.swift.xxx> (raw)

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.2.1 (i386-debian-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2002-11-06 on beth, modified by Debian
configured using `configure  i386-debian-linux-gnu --prefix=/usr/local --sharedstatedir=/var/lib --libexecdir=/usr/local/lib --localstatedir=/var/lib --infodir=/usr/local/share/info --mandir=/usr/local/share/man --with-pop=yes --with-x=yes --with-x-toolkit=athena --without-gif'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Evaluating the following `let' form gives varying results, but the results
should be consistent.  Correct results are always returned when `s' is "The
quick fox...", which matches the regexp `r'.  When `s' is "great grey
green...", which does not match `r', the results in my trials have never been
correct: either an 'args-out-of-range' error is raised, or incorrect data is
given, which appears to be the result of applying match-data from matching a
previous value of `s' ("The quick fox...") to the current value of `s'.  Sample
results are copied below.

My *guess* is that when `string-match' fails, it either fails to set
`match-data' or sets it incorrectly in one of two (or more) ways.

(let ((r "\\(qu\\)\\(ick\\)")
      ;; \C-x\C-t to swap next two lines
      ;; \M-\C-x to evaluate the `let' form
      (s "The quick fox jumped quickly.")
      (s "great grey green greasy Limpopo River")
      )
  (string-match r s)
  (list
   (match-data)
   (match-string 0 s)
   (match-string 1 s)
   (match-string 2 s)
   (match-string 3 s)
   (match-beginning 0)
   (match-beginning 1)
   (match-beginning 2)
   (match-beginning 3)
   ))


Debugger entered--Lisp error: (args-out-of-range "great grey green greasy Limpopo River" 27326 27327)
  match-string(0 "great grey green greasy Limpopo River")
  (list (match-data) (match-string 0 s) (match-string 1 s) (match-string 2 s) (match-string 3 s) (match-beginning 0) (match-beginning 1) (match-beginning 2) (match-beginning 3))
  (let ((r "\\(qu\\)\\(ick\\)") (s "The quick fox jumped quickly.") (s "great grey green greasy Limpopo River")) (string-match r s) (list (match-data) (match-string 0 s) (match-string 1 s) (match-string 2 s) (match-string 3 s) (match-beginning 0) (match-beginning 1) (match-beginning 2) (match-beginning 3)))
  eval((let ((r "\\(qu\\)\\(ick\\)") (s "The quick fox jumped quickly.") (s "great grey green greasy Limpopo River")) (string-match r s) (list (match-data) (match-string 0 s) (match-string 1 s) (match-string 2 s) (match-string 3 s) (match-beginning 0) (match-beginning 1) (match-beginning 2) (match-beginning 3))))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp)


Sometimes I get:

((4 9 4 6 6 9) "t gre" "t " "gre" nil 4 4 6 nil)

I get this less often, and I cannot tell you a reliable way to get it.  I
evaluate the `let' form, evaluate one or more individual lines
e.g. (match-beginning 2), swap the `s' strings, and evaluate the `let' form
again.  Then most of the time I still get the error, but sometimes I get these
incorrect results.

Notice that the match-data is the same as for a successful match of the other
string:

((4 9 4 6 6 9) quick qu ick nil 4 4 6 nil)






Recent input:
<mouse-1> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-1> <mouse-1> C-a C-n <return> 
M-1 C-n C-n C-n C-n C-n C-n <return> C-n C-n <return> 
M-1 C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-p <return> <help-echo> <help-echo> <down-mouse-1> 
<mouse-1> C-a C-SPC C-n C-n C-n C-n C-n C-n C-n C-SPC 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p M-w C-x o q g M-x r e p o r t - e m a c s - b u 
g <return>

Recent messages:
nndiary: Reading incoming mail (no new mail)...done
1 -> require: nnmail
1 <- require: nnmail
1 -> require: nnmail
1 <- require: nnmail
Checking new news...done
Loading emacsbug...
1 -> require: sendmail
1 <- require: sendmail
Loading emacsbug...done

             reply	other threads:[~2003-02-12  3:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-12  3:16 Matthew Swift [this message]
2003-02-12 10:53 ` `match-data' set improperly Kim F. Storm
2003-02-12 19:25   ` Matt Swift
     [not found] ` <mailman.1845.1045043916.21513.bug-gnu-emacs@gnu.org>
2003-02-12 16:02   ` Kevin Rodgers
2003-02-13 10:08     ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2003-02-13  0:54 Luc Teirlinck
2003-02-13  6:42 ` Matt Swift
2003-02-13 12:25   ` Kim F. Storm

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

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

  git send-email \
    --in-reply-to=200302120316.h1C3Gvcu007789@beth.swift.xxx \
    --to=swift@alum.mit.edu \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.