unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: help-gnu-emacs@gnu.org
Subject: Re: Advanced query-replace-regexp in code
Date: Thu, 28 May 2009 04:57:30 GMT	[thread overview]
Message-ID: <878wkhakp1.fsf@iki.fi> (raw)
In-Reply-To: barmar-5F3651.21191327052009@mara100-84.onlink.net

On 2009-05-27 21:19 (-0400), Barry Margolin wrote:

> In interactive calls, the replacement text may contain `\,'
>
> It's a special extension just for interactive use. I'm not sure why it
> was restricted this way.

I think in Lisp programs it's much easier and more problem-free to
evaluate Lisp expressions normal Lisp-way than to write expressions
inside strings and use the "\\,expression" form there.

Interactive replace string

    \,(capitalize \1)

can be written as

    (capitalize (match-string 1))

in programs. With functions like "concat" or "format" the latter
expression can be concatenated with the surrounding replace string.


  reply	other threads:[~2009-05-28  4:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-27 14:03 Advanced query-replace-regexp in code Nordlöw
2009-05-27 14:32 ` Pascal J. Bourguignon
2009-05-28  1:19 ` Barry Margolin
2009-05-28  4:57   ` Teemu Likonen [this message]
2009-05-28  7:04     ` Barry Margolin
2009-05-28 19:36       ` Johan Bockgård
     [not found]       ` <mailman.8013.1243539406.31690.help-gnu-emacs@gnu.org>
2009-05-29  2:14         ` Barry Margolin
2009-05-30  6:34           ` Nordlöw
2009-05-30 18:55           ` Johan Bockgård
     [not found]           ` <mailman.8166.1243709727.31690.help-gnu-emacs@gnu.org>
2009-05-31  1:57             ` Barry Margolin
2009-05-28 19:50 ` harven
2009-08-02 16:19 ` David Kastrup
2009-08-02 17:14   ` Thierry Volpiatto
2009-08-02 20:25     ` Thierry Volpiatto

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=878wkhakp1.fsf@iki.fi \
    --to=tlikonen@iki.fi \
    --cc=help-gnu-emacs@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.
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).