From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Roland Winkler Newsgroups: gmane.emacs.help Subject: Re: replace-match: end of the replacement text for strings Date: 16 Sep 2002 19:47:54 +0200 Organization: FAU Erlangen-Nuernberg Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <5lwupmoxry.fsf@rum.cs.yale.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1032198976 8608 127.0.0.1 (16 Sep 2002 17:56:16 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 16 Sep 2002 17:56:16 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17r06X-0002EQ-00 for ; Mon, 16 Sep 2002 19:56:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17r06p-0004Ho-00; Mon, 16 Sep 2002 13:56:31 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news-nue1.dfn.de!uni-erlangen.de!news.uni-erlangen.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-NNTP-Posting-Host: tfkp07.physik.uni-erlangen.de Original-X-Trace: rznews2.rrze.uni-erlangen.de 1032198475 11968 131.188.164.207 (16 Sep 2002 17:47:55 GMT) Original-X-Complaints-To: news@uni-erlangen.de Original-NNTP-Posting-Date: 16 Sep 2002 17:47:55 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: nntp.stanford.edu gnu.emacs.help:104952 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:1507 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:1507 "Stefan Monnier " writes: > >>>>> "Roland" == Roland Winkler 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