"Stephen J. Turnbull" <stephen(a)xemacs.org> writes:
Mike Kupfer writes:
> would be simplified by the use of match-substitute-replacement,
> which was introduced in Emacs 23.
>
> (defun match-substitute-replacement (replacement &optional
> fixedcase literal string subexp)
> Does XEmacs have anything like this? Or should I tell the Gnus
> folks to define the function if it's not present?
If you can find the author, you could ask if he will license the code
to XEmacs under GPLv2 or later; then we can put it in xemacs-base and
it will work with XEmacs 21.4 too.
Alternatively, do a cleanroom implementation from a description. Update
to upstream once XEmacs has moved to GPLv3(+). Here is a description:
match-substitute-replacement does a replacement and returns only the
replacement of the matched part (see replace-match for details about the
arguments).
It does this by getting the substring or buffer-substring corresponding
to the subexp match, getting the match-data as integers (never as
markers), adjusting the match-data to correspond to the positions in the
substring rather than the original, and then executing replace-match on
the substring. Those parts of the match-data pointing into the wild
regarding the substring (before its beginning or after its end) are not
used in the replace-match, so you'll get away without triggering errors.
Be sure to cater for the case where the buffer itself is an element of
the match-data: adding an offset to it will not do.
The whole is wrapped in an outer save-match-data in order not to leave
the rather haphazard matchdata reinterpretaion around.
--
David Kastrup
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/mailman/listinfo/xemacs-beta