unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Matt Swift" <swift@alum.mit.edu>
Cc: "'Kim F. Storm'" <no-spam@cua.dk>
Subject: RE: `match-data' set improperly
Date: Thu, 13 Feb 2003 01:42:30 -0500	[thread overview]
Message-ID: <001301c2d32b$17f71b40$6200a8c0@swift.xxx> (raw)
In-Reply-To: <200302130054.SAA09991@eel.dms.auburn.edu>

I stand corrected.

Nevertheless I see a strong case for revising both the documentation and the
behavior of the function.  Searches fail frequently and are often expected
to fail, and though I acknowledge the relevant information was available, I
will presume to say that reasonably competent, conscientious, and
experienced people can overlook it.  This essential information should be in
the docstring and the TeXinfo documentation of `string-match' etc, not
merely in the TeXinfo discussion of these functions. 

The second sentence you quote is almost meaningless.  "did not do this" --
did not do WHAT? alter it, or not alter it?  Likewise, one cannot tell what
might be changed to what in the future.

As I wrote earlier today, I find good reasons to want failed searches to set
the match data in a manner consistent with failed submatches, and I see no
good reason to refrain from doing so.  I doubt the efficiency advantage to
declining to set the match-data to (nil nil) is even measurable, and as a
matter of principle, well-defined data can not be less useful than undefined
data.

-----Original Message-----
From: Luc Teirlinck [mailto:teirllm@dms.auburn.edu] 
Sent: Wednesday, February 12, 2003 7:55 PM
To: Matthew Swift
Cc: bug-gnu-emacs@gnu.org; 'Kim F. Storm'
Subject: `match-data' set improperly


Matthew Swift wrote:

    The documentation (TeXinfo and docstrings) is pretty clear that
    (match-string N) when submatch N>0 does not match anything is nil,
    and = it is also clear that (match-string 0) is like the case for
    N>0 but referring = to the entire match instead of a submatch.
    There is no suggestion that match-data is ever undefined, once one
    match has been done,

The following in the Elisp manual (Chapter: Searching and Matching, Simple
Match Data Access) suggests exactly that to me:

       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.

Sincerely,

Luc.

  reply	other threads:[~2003-02-13  6:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-13  0:54 `match-data' set improperly Luc Teirlinck
2003-02-13  6:42 ` Matt Swift [this message]
2003-02-13 12:25   ` Kim F. Storm
  -- strict thread matches above, loose matches on Subject: below --
2003-02-12  3:16 Matthew Swift
2003-02-12 10:53 ` 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

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='001301c2d32b$17f71b40$6200a8c0@swift.xxx' \
    --to=swift@alum.mit.edu \
    --cc=no-spam@cua.dk \
    /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).