[Top][All Lists]

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

Re: Advanced query-replace-regexp in code

From: Teemu Likonen
Subject: Re: Advanced query-replace-regexp in code
Date: Thu, 28 May 2009 04:57:30 GMT
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

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 via email to

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