help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: replace-match: end of the replacement text for strings


From: Roland Winkler
Subject: Re: replace-match: end of the replacement text for strings
Date: 16 Sep 2002 19:47:54 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

"Stefan Monnier <address@hidden>" 
<monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:

> >>>>> "Roland" == Roland Winkler <address@hidden> writes:
> > When I use replace-match to operate on a string, is there an easy
> > way to find out the end of the replacement text in the string that
> > is returned by replace-match (like point in a buffer)? I have in
> > mind the situation when the optional arg LITERAL is nil, i.e., the
> > replacement text is `derived' from the string that is passed to
> > replace-match.
> 
> You should be able to get it by looking at the size of the string
> before and after replacement as well as the size of the replaced
> text. It's a bit round-about, but I can't think of any other way.

In general, doesn't this work only when I know the replacement text
-- which I don't know when I have LITERAL set to nil and I am using
something like "\1" in the replacement?

Would it make sense to have something similar to match-data, i.e., a
lisp variable where the end of the replacement text is stored? Or is
the above situation too rare to justify such a thing? When
replace-match is operating on a buffer, it leaves point at the end
of the replacement text. So I guess that the function `knows' the
end of the replacement text anyway, even when operating on strings.

Roland


reply via email to

[Prev in Thread] Current Thread [Next in Thread]