[comp.emacs] match-beginning/match-end behavior

worley@compass.com (Dale Worley) (02/27/90)

johnd@Stardent.COM (John R. Dennis @stardent) writes:
> To detect if there was a match for a particular sub-expression the
> elisp code was relying on the fact that (match-beginning n) would return nil
> if there was no match for sub-expression n. We are using GNU emacs version
> 18.50.  If there is no match it generates an error.

Yes, the behavior of match-beginning/match-end has changed in recent
versions.  In the most recent versions of Emacs, they return nil for
subexpressions that don't match.  Since I use Emerge on versions 18.53
and 18.54, I haven't worried about the change.

Presumably the Emacs developers changed the behavior for exactly the
reasons you describe.  I assume upward-compatibility wasn't a problem,
because very little code relies on an operation returning an error in
certain circumstances.

Dale Worley		Compass, Inc.			worley@compass.com
--
Civilization ends at the water's edge.  On the ocean, you enter the food chain,
and not necessarily at the top.