From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general,gmane.emacs.devel Subject: Re: replace matches in any string Date: Wed, 01 Sep 2010 08:55:22 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87sk1tk1px.fsf@lifelogs.com> 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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1283349623 18869 80.91.229.12 (1 Sep 2010 14:00:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 1 Sep 2010 14:00:23 +0000 (UTC) Cc: emacs-devel@gnu.org To: ding@gnus.org Original-X-From: ding-owner+M18640@lists.math.uh.edu Wed Sep 01 16:00:16 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OqnrL-0003zp-RQ for ding-account@gmane.org; Wed, 01 Sep 2010 16:00:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1OqnrH-000883-RC; Wed, 01 Sep 2010 09:00:11 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1OqnrG-00087m-Dy for ding@lists.math.uh.edu; Wed, 01 Sep 2010 09:00:10 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1OqnrB-0006dE-NB for ding@lists.math.uh.edu; Wed, 01 Sep 2010 09:00:10 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1OqnrB-00060L-00 for ; Wed, 01 Sep 2010 16:00:05 +0200 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OqnrA-0003qz-My for ding@gnus.org; Wed, 01 Sep 2010 16:00:04 +0200 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Sep 2010 16:00:04 +0200 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Sep 2010 16:00:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 31 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:fo7nE9GCHV7k32/AAiB3uvfZtPY= X-Spam-Score: -0.7 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:70254 gmane.emacs.devel:129554 Archived-At: On Fri, 30 Jul 2010 12:43:28 -0500 Ted Zlatanov wrote: TZ> I'll try to explain more clearly since there haven't been responses. TZ> Daniel said: TZ> "The idea is to use the match-data informations to expand positional TZ> parameters in any string, where replace-match only works on the one the TZ> match occurs." TZ> So for example, we can say: TZ> (when (string-match TZ> "\\(daniel\\)" TZ> "daniel.dehennin@baby-gnu.org") TZ> (replace-match "Daniel is \\1" nil nil "daniel.dehennin@baby-gnu.org" 1)) TZ> -> "Daniel is daniel.dehennin@baby-gnu.org" TZ> But replace-match needs to be passed the same string that matched TZ> ("daniel.dehennin@baby-gnu.org" in the example). How can we replace \\1 TZ> and the other positional parameters in arbitrary text? Gnus has TZ> nnmail-expand-newtext[1] to do this and it would be great to avoid special TZ> code to do it, or if such code can't be avoided, at least move it TZ> outside Gnus because IMO it's generally applicable and useful. I haven't heard any comments on this. It's blocking a Gnus feature so I'd really like to get it done; the code is ready[1] so I simply need to know if this functionality should be in Emacs or only in Gnus. Ted [1] --or we'll make Lars hack it until it's ready, you've been warned--