From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Davis Herring" Newsgroups: gmane.emacs.devel Subject: Re: replace matches in any string Date: Thu, 2 Sep 2010 15:40:52 -0700 (PDT) Message-ID: <60831.130.55.118.19.1283467252.squirrel@webmail.lanl.gov> References: <87ab3gfb41.fsf@hati.baby-gnu.org> <87r5wrgg8w.fsf@lifelogs.com> <87y6gvwryp.fsf@hati.baby-gnu.org> <87d3y7p1ie.fsf@gnu.org> <87633y7v02.fsf@hati.baby-gnu.org> <87vdbyccgg.fsf@hati.baby-gnu.org> <87eiikdfub.fsf@hati.baby-gnu.org> <87ocf18ntz.fsf@hati.baby-gnu.org> <87aaq2uldu.fsf@lifelogs.com> <87y6dg5vv2.fsf@hati.baby-gnu.org> <878w4skgqn.fsf_-_@lifelogs.com> <87sk1tk1px.fsf@lifelogs.com> <87fwxs5m0h.fsf@lifelogs.com> <87r5hc2hvr.fsf@lifelogs.com> <87vd6ocb6s.fsf@lola.goethe.zz> Reply-To: herring@lanl.gov NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1283467298 30990 80.91.229.12 (2 Sep 2010 22:41:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Sep 2010 22:41:38 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 03 00:41:37 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OrIT3-0008DU-5F for ged-emacs-devel@m.gmane.org; Fri, 03 Sep 2010 00:41:34 +0200 Original-Received: from localhost ([127.0.0.1]:59342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrISu-0004af-3M for ged-emacs-devel@m.gmane.org; Thu, 02 Sep 2010 18:41:04 -0400 Original-Received: from [140.186.70.92] (port=47534 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrISo-0004aE-QO for emacs-devel@gnu.org; Thu, 02 Sep 2010 18:40:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OrISn-00038K-7f for emacs-devel@gnu.org; Thu, 02 Sep 2010 18:40:58 -0400 Original-Received: from proofpoint2.lanl.gov ([204.121.3.26]:46660) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OrISm-000387-VV for emacs-devel@gnu.org; Thu, 02 Sep 2010 18:40:57 -0400 Original-Received: from mailrelay2.lanl.gov (mailrelay2.lanl.gov [128.165.4.103]) by proofpoint2.lanl.gov (8.14.3/8.14.3) with ESMTP id o82NGl7V031722 for ; Thu, 2 Sep 2010 17:16:48 -0600 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay2.lanl.gov (Postfix) with ESMTP id B27251A895CD for ; Thu, 2 Sep 2010 16:40:52 -0600 (MDT) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay2.lanl.gov Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay2.lanl.gov (Postfix) with ESMTP id 9FEC01A895B5 for ; Thu, 2 Sep 2010 16:40:52 -0600 (MDT) Original-Received: by webmail1.lanl.gov (Postfix, from userid 48) id 9D9801CA8380; Thu, 2 Sep 2010 16:40:52 -0600 (MDT) Original-Received: from 130.55.118.19 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Thu, 2 Sep 2010 15:40:52 -0700 (PDT) In-Reply-To: User-Agent: SquirrelMail/1.4.8-5.el5_4.10.lanl3 X-Priority: 3 (Normal) Importance: Normal X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.0.10011, 1.0.148, 0.0.0000 definitions=2010-09-02_14:2010-09-02, 2010-09-02, 1970-01-01 signatures=0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:129618 Archived-At: > This doesn't help at all. > > The use case is that you had some string do a match, but you don't have > access to the string variable. You just want the matches that you know > were made, aka perlish $1, $2, $3. I reiterate my first posting on this > issue as a feature request. I don't know why you'd permanently lose the string you matched against, but m-s-r does let you write (defun format-matches (fmt regexp str) "Replace \\1 \\& etc. in FMT with matches from REGEXP against STR." (string-match regexp str) (match-substitute-replacement fmt nil nil str)) ...in which case you only need to pass the string to one function. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.