From: Ted Zlatanov <tzz@lifelogs.com>
To: ding@gnus.org
Cc: emacs-devel@gnu.org
Subject: Re: replace matches in any string
Date: Wed, 01 Sep 2010 08:55:22 -0500 [thread overview]
Message-ID: <87sk1tk1px.fsf@lifelogs.com> (raw)
In-Reply-To: 878w4skgqn.fsf_-_@lifelogs.com
On Fri, 30 Jul 2010 12:43:28 -0500 Ted Zlatanov <tzz@lifelogs.com> 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--
next prev parent reply other threads:[~2010-09-01 13:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87ab3gfb41.fsf@hati.baby-gnu.org>
[not found] ` <87r5wrgg8w.fsf@lifelogs.com>
[not found] ` <87y6gvwryp.fsf@hati.baby-gnu.org>
[not found] ` <87d3y7p1ie.fsf@gnu.org>
[not found] ` <87633y7v02.fsf@hati.baby-gnu.org>
[not found] ` <m2aatadtda.fsf@igel.home>
[not found] ` <87vdbyccgg.fsf@hati.baby-gnu.org>
[not found] ` <m21vemdo67.fsf@igel.home>
[not found] ` <87eiikdfub.fsf@hati.baby-gnu.org>
[not found] ` <87ocf18ntz.fsf@hati.baby-gnu.org>
2010-07-08 13:57 ` [PATCH] Use replace-match in posting-style Ted Zlatanov
2010-07-12 19:43 ` Daniel Dehennin
2010-07-30 17:43 ` replace matches in any string (was: [PATCH] Use replace-match in posting-style.) Ted Zlatanov
2010-09-01 13:55 ` Ted Zlatanov [this message]
2010-09-02 11:29 ` replace matches in any string Stefan Monnier
2010-09-02 13:10 ` Ted Zlatanov
2010-09-02 14:44 ` Lars Magne Ingebrigtsen
2010-09-02 16:21 ` Stefan Monnier
2010-09-02 16:45 ` David Kastrup
2010-09-02 17:08 ` Ted Zlatanov
2010-09-02 17:22 ` David Kastrup
2010-09-02 17:51 ` Ted Zlatanov
2010-09-02 18:04 ` David Kastrup
2010-09-02 19:12 ` Ted Zlatanov
2010-09-02 19:17 ` Recommended gnus spam filter system? Camm Maguire
2010-09-02 19:42 ` Thorsten Bonow
2010-09-02 20:31 ` Frank Schmitt
2010-09-02 20:38 ` Karl Fogel
2010-09-02 20:27 ` replace matches in any string Stefan Monnier
2010-09-02 22:18 ` Lars Magne Ingebrigtsen
2010-09-02 22:40 ` Davis Herring
2010-09-03 5:33 ` David Kastrup
2010-09-03 17:06 ` Lars Magne Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sk1tk1px.fsf@lifelogs.com \
--to=tzz@lifelogs.com \
--cc=ding@gnus.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).