From: "Stephen J. Turnbull" <stephen@xemacs.org>
Subject: Document that failed search/match preserves match data
Date: Fri, 09 May 2003 23:14:05 +0900 [thread overview]
Message-ID: <87d6isi4wi.fsf@tleepslib.sk.tsukuba.ac.jp> (raw)
Currently in both XEmacs and Emacs a failed search will preserve the
match data from the last successful search (this is true for XEmacs
from regression testing and verifying the code, and if I interpreted a
communication with Stefan Monnier correctly, it is true for Emacs).
However, until now the documentation for both Emacsen strongly implied
(to my mind) that any call to a search or match function would clobber
the match data. As an experiment, in XEmacs I changed it to clear the
match data even on failure, and (as you would expect) got a bunch of
bug reports. This led me to some elegant examples (the function
`w3-configuration-data' in "w3-cfg" is a good one, I think) which
depend on match failure preserving previous match data in an essential
way. (Of course you could work around it but it would be real ugly.)
I propose that the docstrings and Info documentation for both Emacsen
be amended to reflect the (common) behavior of the implementations,
since it seems to be useful. That is, we state that
"On success, a search or match sets the match data for the whole
expression and any matched subexpressions. If the search or match
fails, the match data from the most recent successful search will be
preserved. (You should not depend on the match data being preserved
in case of an error in the search function.)"[1]
Footnotes:
[1] In the case of XEmacs, I'm pretty sure that even on errors the
previous match data is preserved, but of course that's a little harder
to be sure of than with normal termination.
--
Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
next reply other threads:[~2003-05-09 14:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-09 14:14 Stephen J. Turnbull [this message]
2003-05-10 17:15 ` Document that failed search/match preserves match data 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d6isi4wi.fsf@tleepslib.sk.tsukuba.ac.jp \
--to=stephen@xemacs.org \
/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.