emacs-devel
[Top][All Lists]
Advanced

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

Re: replace matches in any string


From: Ted Zlatanov
Subject: Re: replace matches in any string
Date: Wed, 01 Sep 2010 08:55:22 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

On Fri, 30 Jul 2010 12:43:28 -0500 Ted Zlatanov <address@hidden> 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>        "address@hidden")
TZ>   (replace-match "Daniel is \\1" nil nil "address@hidden" 1))
TZ> -> "Daniel is address@hidden"

TZ> But replace-match needs to be passed the same string that matched
TZ> ("address@hidden" 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--




reply via email to

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